- File:
-
- 1 edited
-
src/unittests/listofbondsunittest.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/listofbondsunittest.cpp
re6fdbe rcbc5fb 16 16 #include "listofbondsunittest.hpp" 17 17 18 #include "World.hpp" 18 19 #include "atom.hpp" 19 20 #include "bond.hpp" … … 21 22 #include "molecule.hpp" 22 23 #include "periodentafel.hpp" 23 #include "World.hpp"24 25 #ifdef HAVE_TESTRUNNER26 #include "UnitTestMain.hpp"27 #endif /*HAVE_TESTRUNNER*/28 24 29 25 /********************************************** Test classes **************************************/ … … 50 46 51 47 // construct periodentafel 52 tafel = new periodentafel;48 tafel = World::get()->getPeriode(); 53 49 tafel->AddElement(hydrogen); 54 50 55 51 // construct molecule (tetraeder of hydrogens) 56 TestMolecule = new molecule(tafel);57 Walker = new atom();52 TestMolecule = World::get()->createMolecule(); 53 Walker = World::get()->createAtom(); 58 54 Walker->type = hydrogen; 59 55 Walker->node->Init(1., 0., 1. ); 60 56 TestMolecule->AddAtom(Walker); 61 Walker = new atom();57 Walker = World::get()->createAtom(); 62 58 Walker->type = hydrogen; 63 59 Walker->node->Init(0., 1., 1. ); 64 60 TestMolecule->AddAtom(Walker); 65 Walker = new atom();61 Walker = World::get()->createAtom(); 66 62 Walker->type = hydrogen; 67 63 Walker->node->Init(1., 1., 0. ); 68 64 TestMolecule->AddAtom(Walker); 69 Walker = new atom();65 Walker = World::get()->createAtom(); 70 66 Walker->type = hydrogen; 71 67 Walker->node->Init(0., 0., 0. ); … … 81 77 { 82 78 // remove 83 delete(TestMolecule);79 World::get()->destroyMolecule(TestMolecule); 84 80 // note that all the atoms are cleaned by TestMolecule 85 delete(tafel);86 // note that element is cleaned by periodentafel87 81 World::destroy(); 88 MemoryUsageObserver::purgeInstance();89 logger::purgeInstance();90 82 }; 91 83 … … 250 242 251 243 // remove atom2 252 delete(atom2);244 World::get()->destroyAtom(atom2); 253 245 254 246 // check bond if removed from other atom … … 258 250 CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last ); 259 251 }; 252 253 /********************************************** Main routine **************************************/ 254 255 int main(int argc, char **argv) 256 { 257 // Get the top level suite from the registry 258 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); 259 260 // Adds the test to the list of test to run 261 CppUnit::TextUi::TestRunner runner; 262 runner.addTest( suite ); 263 264 // Change the default outputter to a compiler error format outputter 265 runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), 266 std::cerr ) ); 267 // Run the tests. 268 bool wasSucessful = runner.run(); 269 270 // Return error code 1 if the one of test failed. 271 return wasSucessful ? 0 : 1; 272 };
Note:
See TracChangeset
for help on using the changeset viewer.
