- File:
-
- 1 edited
-
src/unittests/analysisbondsunittest.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/analysisbondsunittest.cpp
rcbc5fb r9b6b2f 16 16 #include <cstring> 17 17 18 #include "World.hpp"19 18 #include "analysis_bonds.hpp" 20 19 #include "analysisbondsunittest.hpp" … … 25 24 #include "molecule.hpp" 26 25 #include "periodentafel.hpp" 26 27 #ifdef HAVE_TESTRUNNER 28 #include "UnitTestMain.hpp" 29 #endif /*HAVE_TESTRUNNER*/ 27 30 28 31 /********************************************** Test classes **************************************/ … … 57 60 58 61 // construct periodentafel 59 tafel = World::get()->getPeriode();62 tafel = new periodentafel; 60 63 tafel->AddElement(hydrogen); 61 64 tafel->AddElement(carbon); 62 65 63 66 // construct molecule (tetraeder of hydrogens) 64 TestMolecule = World::get()->createMolecule();65 Walker = World::get()->createAtom();67 TestMolecule = new molecule(tafel); 68 Walker = new atom(); 66 69 Walker->type = hydrogen; 67 70 Walker->node->Init(1.5, 0., 1.5 ); 68 71 TestMolecule->AddAtom(Walker); 69 Walker = World::get()->createAtom();72 Walker = new atom(); 70 73 Walker->type = hydrogen; 71 74 Walker->node->Init(0., 1.5, 1.5 ); 72 75 TestMolecule->AddAtom(Walker); 73 Walker = World::get()->createAtom();76 Walker = new atom(); 74 77 Walker->type = hydrogen; 75 78 Walker->node->Init(1.5, 1.5, 0. ); 76 79 TestMolecule->AddAtom(Walker); 77 Walker = World::get()->createAtom();80 Walker = new atom(); 78 81 Walker->type = hydrogen; 79 82 Walker->node->Init(0., 0., 0. ); 80 83 TestMolecule->AddAtom(Walker); 81 Walker = World::get()->createAtom();84 Walker = new atom(); 82 85 Walker->type = carbon; 83 86 Walker->node->Init(0.5, 0.5, 0.5 ); … … 113 116 114 117 // remove molecule 115 World::get()->destroyMolecule(TestMolecule);118 delete(TestMolecule); 116 119 // note that all the atoms are cleaned by TestMolecule 117 World::destroy(); 120 delete(tafel); 121 // note that element is cleaned by periodentafel 118 122 }; 119 123 … … 163 167 CPPUNIT_ASSERT_EQUAL( 0. , Max ); 164 168 }; 165 166 167 /********************************************** Main routine **************************************/168 169 int main(int argc, char **argv)170 {171 // Get the top level suite from the registry172 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();173 174 // Adds the test to the list of test to run175 CppUnit::TextUi::TestRunner runner;176 runner.addTest( suite );177 178 // Change the default outputter to a compiler error format outputter179 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.
