- File:
-
- 1 edited
-
src/unittests/analysisbondsunittest.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/analysisbondsunittest.cpp
r9b6b2f rcbc5fb 16 16 #include <cstring> 17 17 18 #include "World.hpp" 18 19 #include "analysis_bonds.hpp" 19 20 #include "analysisbondsunittest.hpp" … … 24 25 #include "molecule.hpp" 25 26 #include "periodentafel.hpp" 26 27 #ifdef HAVE_TESTRUNNER28 #include "UnitTestMain.hpp"29 #endif /*HAVE_TESTRUNNER*/30 27 31 28 /********************************************** Test classes **************************************/ … … 60 57 61 58 // construct periodentafel 62 tafel = new periodentafel;59 tafel = World::get()->getPeriode(); 63 60 tafel->AddElement(hydrogen); 64 61 tafel->AddElement(carbon); 65 62 66 63 // construct molecule (tetraeder of hydrogens) 67 TestMolecule = new molecule(tafel);68 Walker = new atom();64 TestMolecule = World::get()->createMolecule(); 65 Walker = World::get()->createAtom(); 69 66 Walker->type = hydrogen; 70 67 Walker->node->Init(1.5, 0., 1.5 ); 71 68 TestMolecule->AddAtom(Walker); 72 Walker = new atom();69 Walker = World::get()->createAtom(); 73 70 Walker->type = hydrogen; 74 71 Walker->node->Init(0., 1.5, 1.5 ); 75 72 TestMolecule->AddAtom(Walker); 76 Walker = new atom();73 Walker = World::get()->createAtom(); 77 74 Walker->type = hydrogen; 78 75 Walker->node->Init(1.5, 1.5, 0. ); 79 76 TestMolecule->AddAtom(Walker); 80 Walker = new atom();77 Walker = World::get()->createAtom(); 81 78 Walker->type = hydrogen; 82 79 Walker->node->Init(0., 0., 0. ); 83 80 TestMolecule->AddAtom(Walker); 84 Walker = new atom();81 Walker = World::get()->createAtom(); 85 82 Walker->type = carbon; 86 83 Walker->node->Init(0.5, 0.5, 0.5 ); … … 116 113 117 114 // remove molecule 118 delete(TestMolecule);115 World::get()->destroyMolecule(TestMolecule); 119 116 // note that all the atoms are cleaned by TestMolecule 120 delete(tafel); 121 // note that element is cleaned by periodentafel 117 World::destroy(); 122 118 }; 123 119 … … 167 163 CPPUNIT_ASSERT_EQUAL( 0. , Max ); 168 164 }; 165 166 167 /********************************************** Main routine **************************************/ 168 169 int main(int argc, char **argv) 170 { 171 // Get the top level suite from the registry 172 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); 173 174 // Adds the test to the list of test to run 175 CppUnit::TextUi::TestRunner runner; 176 runner.addTest( suite ); 177 178 // Change the default outputter to a compiler error format outputter 179 runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), 180 std::cerr ) ); 181 // Run the tests. 182 bool wasSucessful = runner.run(); 183 184 // Return error code 1 if the one of test failed. 185 return wasSucessful ? 0 : 1; 186 };
Note:
See TracChangeset
for help on using the changeset viewer.
