- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/unittests/atomsCalculationTest.cpp ¶
r57adc7 re73a8a2 23 23 #include "World_calculations.hpp" 24 24 #include "atom.hpp" 25 26 #ifdef HAVE_TESTRUNNER 27 #include "UnitTestMain.hpp" 28 #endif /*HAVE_TESTRUNNER*/ 25 29 26 30 // Registers the fixture into the 'registry' … … 51 55 // set up and tear down 52 56 void atomsCalculationTest::setUp(){ 53 World::get ();57 World::getInstance(); 54 58 for(int i=0;i<ATOM_COUNT;++i){ 55 59 atoms[i]= new AtomStub(i); 56 World::get ()->registerAtom(atoms[i]);60 World::getInstance().registerAtom(atoms[i]); 57 61 } 58 62 } 59 63 void atomsCalculationTest::tearDown(){ 60 World:: destroy();61 ActionRegistry::purge Registry();64 World::purgeInstance(); 65 ActionRegistry::purgeInstance(); 62 66 } 63 67 … … 92 96 } 93 97 94 static void operation(atom* _atom){95 AtomStub *atom = dynamic_cast<AtomStub*>(_atom);96 assert(atom);97 atom->doSomething();98 }99 100 101 98 void atomsCalculationTest::testCalculateSimple(){ 102 AtomsCalculation<int> *calc = World::get ()->calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms());99 AtomsCalculation<int> *calc = World::getInstance().calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms()); 103 100 std::vector<int> allIds = (*calc)(); 104 101 CPPUNIT_ASSERT(hasAll(allIds,0,ATOM_COUNT)); … … 108 105 void atomsCalculationTest::testCalculateExcluded(){ 109 106 int excluded = ATOM_COUNT/2; 110 AtomsCalculation<int> *calc = World::get ()->calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded));107 AtomsCalculation<int> *calc = World::getInstance().calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded)); 111 108 std::vector<int> allIds = (*calc)(); 112 109 std::set<int> excluded_set;
Note:
See TracChangeset
for help on using the changeset viewer.