Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/atomsCalculationTest.cpp

    re73a8a2 r57adc7  
    2323#include "World_calculations.hpp"
    2424#include "atom.hpp"
    25 
    26 #ifdef HAVE_TESTRUNNER
    27 #include "UnitTestMain.hpp"
    28 #endif /*HAVE_TESTRUNNER*/
    2925
    3026// Registers the fixture into the 'registry'
     
    5551// set up and tear down
    5652void atomsCalculationTest::setUp(){
    57   World::getInstance();
     53  World::get();
    5854  for(int i=0;i<ATOM_COUNT;++i){
    5955    atoms[i]= new AtomStub(i);
    60     World::getInstance().registerAtom(atoms[i]);
     56    World::get()->registerAtom(atoms[i]);
    6157  }
    6258}
    6359void atomsCalculationTest::tearDown(){
    64   World::purgeInstance();
    65   ActionRegistry::purgeInstance();
     60  World::destroy();
     61  ActionRegistry::purgeRegistry();
    6662}
    6763
     
    9692}
    9793
     94static void operation(atom* _atom){
     95  AtomStub *atom = dynamic_cast<AtomStub*>(_atom);
     96  assert(atom);
     97  atom->doSomething();
     98}
     99
     100
    98101void atomsCalculationTest::testCalculateSimple(){
    99   AtomsCalculation<int> *calc = World::getInstance().calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms());
     102  AtomsCalculation<int> *calc = World::get()->calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms());
    100103  std::vector<int> allIds = (*calc)();
    101104  CPPUNIT_ASSERT(hasAll(allIds,0,ATOM_COUNT));
     
    105108void atomsCalculationTest::testCalculateExcluded(){
    106109  int excluded = ATOM_COUNT/2;
    107   AtomsCalculation<int> *calc = World::getInstance().calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded));
     110  AtomsCalculation<int> *calc = World::get()->calcOnAtoms<int>(boost::bind(&atom::getId,_1),"FOO",AllAtoms() && !AtomById(excluded));
    108111  std::vector<int> allIds = (*calc)();
    109112  std::set<int> excluded_set;
Note: See TracChangeset for help on using the changeset viewer.