/* IBM_PROLOG_BEGIN_TAG * This is an automatically generated prolog. * * $Source: src/usr/hwas/test/hwas1test.H $ * * IBM CONFIDENTIAL * * COPYRIGHT International Business Machines Corp. 2011-2012 * * p1 * * Object Code Only (OCO) source materials * Licensed Internal Code Source Materials * IBM HostBoot Licensed Internal Code * * The source code for this program is not published or other- * wise divested of its trade secrets, irrespective of what has * been deposited with the U.S. Copyright Office. * * Origin: 30 * * IBM_PROLOG_END_TAG */ #ifndef __TESTTARGETING_H #define __TESTTARGETING_H /** * @file testtargeting.H * * @brief Unit tests for HWAS (ISTEP 4) */ //****************************************************************************** // Includes //****************************************************************************** // STD #include #include // CXXTEST #include #include #include #include #include #include // This component #include class HWAS1test: public CxxTest::TestSuite { public: /** * @brief Write to all the attributes and then read them back. */ void testHWASReadWrite() { using namespace TARGETING; TARGETING::HwasState l_orgHwasState, l_hwasState; TARGETING::TargetIterator l_pTarget; TS_TRACE( "testHWASReadWrite entry" ); // write a pattern to all HWAS attributes and then read them back for( l_pTarget = TARGETING::targetService().begin(); l_pTarget != TARGETING::targetService().end(); ++l_pTarget ) { // save original state l_orgHwasState = l_pTarget->getAttr(); // modify state l_hwasState = l_pTarget->getAttr(); l_hwasState.poweredOn = true; l_hwasState.present = true; l_hwasState.functional = true; l_hwasState.changedSinceLastIPL = true; // Now write the modified value back to Targeting. l_pTarget->setAttr( l_hwasState ); // fetch and test new values if ( l_pTarget->getAttr().poweredOn != true ) { TS_FAIL( "poweredOn = 0x%x, should be true", l_pTarget->getAttr().poweredOn ); } if ( l_pTarget->getAttr().present != true ) { TS_FAIL( " present = 0x%x should be true", l_pTarget->getAttr().present ); } if ( l_pTarget->getAttr().functional != true ) { TS_FAIL( " functional = 0x%x, should be true", l_pTarget->getAttr().functional ); } if ( l_pTarget->getAttr().changedSinceLastIPL != true ) { TS_FAIL( " changedSinceLastIPL = 0x%x, should be true", l_pTarget->getAttr().changedSinceLastIPL ); } // // Now write the original value back. // l_pTarget->setAttr( l_orgHwasState ); // check that it got written back correctly if ( l_pTarget->getAttr().poweredOn != l_orgHwasState.poweredOn ) { TS_FAIL( "poweredOn = 0x%x, not restored", l_pTarget->getAttr().poweredOn ); } if ( l_pTarget->getAttr().present != l_orgHwasState.present ) { TS_FAIL( " present = 0x%x, not restored", l_pTarget->getAttr().present ); } if ( l_pTarget->getAttr().functional != l_orgHwasState.functional ) { TS_FAIL( " functional = 0x%x, not restored", l_pTarget->getAttr().functional ); } if ( l_pTarget->getAttr().changedSinceLastIPL != l_orgHwasState.changedSinceLastIPL ) { TS_FAIL( " changedSinceLastIPL = 0x%x, not restored", l_pTarget->getAttr().changedSinceLastIPL ); } } TS_TRACE( "testHWASReadWrite exit" ); } }; #endif //