Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    rcbc5fb re6fdbe  
    1717#include "AnalysisCorrelationToPointUnitTest.hpp"
    1818
    19 #include "World.hpp"
    2019#include "atom.hpp"
    2120#include "boundary.hpp"
     
    2524#include "periodentafel.hpp"
    2625#include "tesselation.hpp"
     26#include "World.hpp"
     27
     28#ifdef HAVE_TESTRUNNER
     29#include "UnitTestMain.hpp"
     30#endif /*HAVE_TESTRUNNER*/
    2731
    2832/********************************************** Test classes **************************************/
     
    5256
    5357  // construct periodentafel
    54   tafel = World::get()->getPeriode();
     58  tafel = new periodentafel;
    5559  tafel->AddElement(hydrogen);
    5660
    5761  // construct molecule (tetraeder of hydrogens)
    58   TestMolecule = World::get()->createMolecule();
    59   Walker = World::get()->createAtom();
     62  TestMolecule = new molecule(tafel);
     63  Walker = new atom();
    6064  Walker->type = hydrogen;
    6165  Walker->node->Init(1., 0., 1. );
    6266  TestMolecule->AddAtom(Walker);
    63   Walker = World::get()->createAtom();
     67  Walker = new atom();
    6468  Walker->type = hydrogen;
    6569  Walker->node->Init(0., 1., 1. );
    6670  TestMolecule->AddAtom(Walker);
    67   Walker = World::get()->createAtom();
     71  Walker = new atom();
    6872  Walker->type = hydrogen;
    6973  Walker->node->Init(1., 1., 0. );
    7074  TestMolecule->AddAtom(Walker);
    71   Walker = World::get()->createAtom();
     75  Walker = new atom();
    7276  Walker->type = hydrogen;
    7377  Walker->node->Init(0., 0., 0. );
     
    7781  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    7882
    79   TestList = World::get()->getMolecules();
     83  TestList = new MoleculeListClass;
    8084  TestMolecule->ActiveFlag = true;
    8185  TestList->insert(TestMolecule);
     
    98102    delete(binmap);
    99103
     104  // remove
     105  delete(TestList);
     106  // note that all the atoms are cleaned by TestMolecule
    100107  delete(point);
     108  delete(tafel);
     109  // note that element is cleaned by periodentafel
    101110  World::destroy();
     111  MemoryUsageObserver::purgeInstance();
     112  logger::purgeInstance();
    102113};
    103114
     
    137148
    138149};
    139 
    140 /********************************************** Main routine **************************************/
    141 
    142 int main(int argc, char **argv)
    143 {
    144   // Get the top level suite from the registry
    145   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    146 
    147   // Adds the test to the list of test to run
    148   CppUnit::TextUi::TestRunner runner;
    149   runner.addTest( suite );
    150 
    151   // Change the default outputter to a compiler error format outputter
    152   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    153                                                        std::cerr ) );
    154   // Run the tests.
    155   bool wasSucessful = runner.run();
    156 
    157   // Return error code 1 if the one of test failed.
    158   return wasSucessful ? 0 : 1;
    159 };
Note: See TracChangeset for help on using the changeset viewer.