/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* $Source: src/usr/diag/attn/hostboot/test/attntestscom.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2014 */ /* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ /* You may obtain a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ /* implied. See the License for the specific language governing */ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ #ifndef __TEST_ATTNTESTSCOM_H #define __TEST_ATTNTESTSCOM_H /** * @file attntestscom.H * * @brief Unit test for the attnscom module. */ #include "attnfakesys.H" #include "attntest.H" #include using namespace ATTN; using namespace TARGETING; /** * @brief AttnScomTest Unit test for the attnscom module. */ class AttnScomTest : public CxxTest::TestSuite { public: /** * @brief testFakeScom Unit test for the * getScom and putScom methods. */ void testFakeScom(void) { static const uint64_t iterations = 100; static const uint64_t targetPoolSize = 100; static const TargetHandle_t targetPool = 0; TS_TRACE(ENTER_MRK "testFakeScom"); errlHndl_t err = 0; FakeSystem d; d.installScomImpl(); TargetHandle_t t; uint64_t data, address, exp; for(uint64_t i = 0; i < iterations; ++i) { t = targetPool + randint(0, targetPoolSize -1); data = randint(0, 0xffffffffffffffffull); address = randint(0, 0xffffffffffffffffull); exp = data; err = putScom(t, address, data); if(err) { TS_FAIL("Unexpected error calling putScom"); break; } data = 0; err = getScom(t, address, data); if(err) { TS_FAIL("Unexpected error calling getScom"); break; } if(data != exp) { TS_FAIL("Unexpected data from getScom %d, %d", data, exp); break; } } TS_TRACE(EXIT_MRK "testFakeScom"); } /** * @brief testModifyScom Unit test for the modify scom method. */ void testModifyScom() { static const uint64_t iterations = 100; static const uint64_t targetPoolSize = 100; static const TargetHandle_t targetPool = 0; TS_TRACE(ENTER_MRK "testModifyScom"); errlHndl_t err = 0; FakeSystem d; d.installScomImpl(); uint64_t data, mask, exp, address, op; TargetHandle_t t; for(uint64_t i = 0; i