Ignore:
Timestamp:
May 5, 2016, 5:14:19 PM (10 years ago)
Author:
Frederik Heber <heber@…>
Parents:
4a319a
git-author:
Frederik Heber <heber@…> (05/05/16 14:54:56)
git-committer:
Frederik Heber <heber@…> (05/05/16 17:14:19)
Message:

Replaced .. by getConstInstance() wherever possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/RandomNumbers/unittests/RandomNumberDistributionFactoryUnitTest.cpp

    r4a319a r94605f  
    104104{
    105105  // 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();
    109110      ++iter) {
    110111    CPPUNIT_ASSERT_EQUAL(
    111112        iter->second,
    112         RandomNumberDistributionFactory::getInstance().getName(
    113             RandomNumberDistributionFactory::getInstance().getEnum(
    114                 iter->second
    115             )
    116         )
     113        factory.getName( factory.getEnum(iter->second) )
    117114    );
    118115  }
    119116
    120117  // 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();
    123119  CPPUNIT_ASSERT_EQUAL(
    124120      std::string(typeid(boost::uniform_smallint<> ).name()),
     
    129125  CPPUNIT_ASSERT_EQUAL( 0., rndA->min() );
    130126  CPPUNIT_ASSERT_EQUAL( 9., rndA->max() );
     127  rndA = NULL;
    131128}
    132129
    133130void RandomNumberDistributionFactoryTest::PrototypeManipulationTest()
    134131{
     132  const RandomNumberDistributionFactory& factory = RandomNumberDistributionFactory::getConstInstance();
    135133  // make unmodified clone
    136   rndA_1 = RandomNumberDistributionFactory::getInstance().
    137       getProduct(RandomNumberDistributionFactory::uniform_smallint);
     134  rndA_1 = factory.getProduct(RandomNumberDistributionFactory::uniform_smallint);
    138135
    139136  // do something with the prototype
     
    157154      manipulatePrototype(std::string("uniform_smallint"), *params);
    158155  // ... and check
    159   rndA_3 = RandomNumberDistributionFactory::getInstance().
    160       getProduct(RandomNumberDistributionFactory::uniform_smallint);
     156  rndA_3 = factory.getProduct(RandomNumberDistributionFactory::uniform_smallint);
    161157  CPPUNIT_ASSERT_EQUAL( 25., rndA_3->max());
    162158  CPPUNIT_ASSERT( rndA_1->max() != rndA_3->max());
Note: See TracChangeset for help on using the changeset viewer.