- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
r3d9df5 r4eb4fe 18 18 19 19 #include "atom.hpp" 20 #include "boundary.hpp"21 20 #include "element.hpp" 22 21 #include "molecule.hpp" 23 22 #include "linkedcell.hpp" 24 23 #include "periodentafel.hpp" 25 #include "tesselation.hpp" 24 #include "World.hpp" 25 26 #ifdef HAVE_TESTRUNNER 27 #include "UnitTestMain.hpp" 28 #endif /*HAVE_TESTRUNNER*/ 26 29 27 30 /********************************************** Test classes **************************************/ … … 37 40 TestList = NULL; 38 41 TestMolecule = NULL; 39 hydrogen = NULL;40 tafel = NULL;41 42 pointmap = NULL; 42 43 binmap = NULL; 43 44 point = NULL; 44 45 45 // construct element46 hydrogen = new element;47 hydrogen->Z = 1;48 strcpy(hydrogen->name, "hydrogen");49 strcpy(hydrogen->symbol, "H");50 51 52 // construct periodentafel53 tafel = new periodentafel;54 tafel->AddElement(hydrogen);55 56 46 // construct molecule (tetraeder of hydrogens) 57 TestMolecule = new molecule(tafel); 58 Walker = new atom(); 47 hydrogen = World::getInstance().getPeriode()->FindElement(1); 48 CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found"); 49 TestMolecule = World::getInstance().createMolecule(); 50 Walker = World::getInstance().createAtom(); 59 51 Walker->type = hydrogen; 60 Walker->node->Init(1., 0., 1. );52 *Walker->node = Vector(1., 0., 1. ); 61 53 TestMolecule->AddAtom(Walker); 62 Walker = new atom();54 Walker = World::getInstance().createAtom(); 63 55 Walker->type = hydrogen; 64 Walker->node->Init(0., 1., 1. );56 *Walker->node = Vector(0., 1., 1. ); 65 57 TestMolecule->AddAtom(Walker); 66 Walker = new atom();58 Walker = World::getInstance().createAtom(); 67 59 Walker->type = hydrogen; 68 Walker->node->Init(1., 1., 0. );60 *Walker->node = Vector(1., 1., 0. ); 69 61 TestMolecule->AddAtom(Walker); 70 Walker = new atom();62 Walker = World::getInstance().createAtom(); 71 63 Walker->type = hydrogen; 72 Walker->node->Init(0., 0., 0. );64 *Walker->node = Vector(0., 0., 0. ); 73 65 TestMolecule->AddAtom(Walker); 74 66 … … 76 68 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 ); 77 69 78 TestList = new MoleculeListClass; 70 TestList = World::getInstance().getMolecules(); 71 TestList->insert(TestMolecule); 79 72 TestMolecule->ActiveFlag = true; 80 TestList->insert(TestMolecule);81 73 82 74 // init point … … 97 89 delete(binmap); 98 90 99 // remove100 delete(TestList);101 // note that all the atoms are cleaned by TestMolecule102 91 delete(point); 103 delete(tafel); 104 // note that element is cleaned by periodentafel 92 World::purgeInstance(); 93 MemoryUsageObserver::purgeInstance(); 94 logger::purgeInstance(); 105 95 }; 106 96 … … 140 130 141 131 }; 142 143 /********************************************** Main routine **************************************/144 145 int main(int argc, char **argv)146 {147 // Get the top level suite from the registry148 CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();149 150 // Adds the test to the list of test to run151 CppUnit::TextUi::TestRunner runner;152 runner.addTest( suite );153 154 // Change the default outputter to a compiler error format outputter155 runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),156 std::cerr ) );157 // Run the tests.158 bool wasSucessful = runner.run();159 160 // Return error code 1 if the one of test failed.161 return wasSucessful ? 0 : 1;162 };
Note:
See TracChangeset
for help on using the changeset viewer.