- Timestamp:
- May 5, 2016, 5:14:19 PM (10 years ago)
- Parents:
- 4a319a
- git-author:
- Frederik Heber <heber@…> (05/05/16 14:54:56)
- git-committer:
- Frederik Heber <heber@…> (05/05/16 17:14:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/RandomNumbers/unittests/RandomNumberDistributionFactoryUnitTest.cpp
r4a319a r94605f 104 104 { 105 105 // check the injectiveness of enum and string map 106 for (RandomNumberDistributionFactory::NameMap::const_iterator 107 iter = RandomNumberDistributionFactory::getInstance().names.begin(); 108 iter != RandomNumberDistributionFactory::getInstance().names.end(); 106 const RandomNumberDistributionFactory& factory = RandomNumberDistributionFactory::getConstInstance(); 107 for (RandomNumberDistributionFactory::NameMap::const_iterator iter = 108 RandomNumberDistributionFactory::names.begin(); 109 iter != RandomNumberDistributionFactory::names.end(); 109 110 ++iter) { 110 111 CPPUNIT_ASSERT_EQUAL( 111 112 iter->second, 112 RandomNumberDistributionFactory::getInstance().getName( 113 RandomNumberDistributionFactory::getInstance().getEnum( 114 iter->second 115 ) 116 ) 113 factory.getName( factory.getEnum(iter->second) ) 117 114 ); 118 115 } 119 116 120 117 // check one of the distributions in the table 121 rndA = RandomNumberDistributionFactory::getInstance(). 122 ManipulablePrototypeTable[RandomNumberDistributionFactory::uniform_smallint]->clone(); 118 rndA = RandomNumberDistributionFactory::ManipulablePrototypeTable[RandomNumberDistributionFactory::uniform_smallint]->clone(); 123 119 CPPUNIT_ASSERT_EQUAL( 124 120 std::string(typeid(boost::uniform_smallint<> ).name()), … … 129 125 CPPUNIT_ASSERT_EQUAL( 0., rndA->min() ); 130 126 CPPUNIT_ASSERT_EQUAL( 9., rndA->max() ); 127 rndA = NULL; 131 128 } 132 129 133 130 void RandomNumberDistributionFactoryTest::PrototypeManipulationTest() 134 131 { 132 const RandomNumberDistributionFactory& factory = RandomNumberDistributionFactory::getConstInstance(); 135 133 // make unmodified clone 136 rndA_1 = RandomNumberDistributionFactory::getInstance(). 137 getProduct(RandomNumberDistributionFactory::uniform_smallint); 134 rndA_1 = factory.getProduct(RandomNumberDistributionFactory::uniform_smallint); 138 135 139 136 // do something with the prototype … … 157 154 manipulatePrototype(std::string("uniform_smallint"), *params); 158 155 // ... and check 159 rndA_3 = RandomNumberDistributionFactory::getInstance(). 160 getProduct(RandomNumberDistributionFactory::uniform_smallint); 156 rndA_3 = factory.getProduct(RandomNumberDistributionFactory::uniform_smallint); 161 157 CPPUNIT_ASSERT_EQUAL( 25., rndA_3->max()); 162 158 CPPUNIT_ASSERT( rndA_1->max() != rndA_3->max());
Note:
See TracChangeset
for help on using the changeset viewer.
