Ignore:
Timestamp:
Feb 19, 2010, 11:49:54 AM (16 years ago)
Author:
Tillmann Crueger <crueger@…>
Children:
01d28a
Parents:
5d4edf
Message:

Added a mechanism that allows the world to track changes done by the manipulators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/unittests/manipulateAtomsTest.cpp

    r5d4edf r9ef76a  
    4949};
    5050
     51class countObserver : public Observer{
     52public:
     53  countObserver() :
     54    count(0)
     55    {}
     56  virtual ~countObserver(){}
     57
     58  void update(Observable *){
     59    count++;
     60  }
     61
     62  void subjectKilled(Observable *)
     63  {}
     64
     65  int count;
     66};
    5167
    5268// set up and tear down
     
    131147}
    132148
     149void manipulateAtomsTest::testObserver(){
     150  countObserver *obs = new countObserver();
     151  World::get()->signOn(obs);
     152  ManipulateAtomsProcess *proc = World::get()->manipulateAtoms(boost::bind(operation,_1),"FOO",AllAtoms() && !AtomById(ATOM_COUNT/2));
     153  proc->call();
     154
     155  CPPUNIT_ASSERT_EQUAL(1,obs->count);
     156  World::get()->signOff(obs);
     157  delete obs;
     158}
     159
    133160/********************************************** Main routine **************************************/
    134161
Note: See TracChangeset for help on using the changeset viewer.