Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    rcbc5fb re6fdbe  
    1717#include "AnalysisPairCorrelationUnitTest.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 **************************************/
     
    5155
    5256  // construct periodentafel
    53   tafel = World::get()->getPeriode();
     57  tafel = new periodentafel;
    5458  tafel->AddElement(hydrogen);
    5559
    5660  // construct molecule (tetraeder of hydrogens)
    57   TestMolecule = World::get()->createMolecule();
    58   Walker = World::get()->createAtom();
     61  TestMolecule = new molecule(tafel);
     62  Walker = new atom();
    5963  Walker->type = hydrogen;
    6064  Walker->node->Init(1., 0., 1. );
    6165  TestMolecule->AddAtom(Walker);
    62   Walker = World::get()->createAtom();
     66  Walker = new atom();
    6367  Walker->type = hydrogen;
    6468  Walker->node->Init(0., 1., 1. );
    6569  TestMolecule->AddAtom(Walker);
    66   Walker = World::get()->createAtom();
     70  Walker = new atom();
    6771  Walker->type = hydrogen;
    6872  Walker->node->Init(1., 1., 0. );
    6973  TestMolecule->AddAtom(Walker);
    70   Walker = World::get()->createAtom();
     74  Walker = new atom();
    7175  Walker->type = hydrogen;
    7276  Walker->node->Init(0., 0., 0. );
     
    7680  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    7781
    78   TestList = World::get()->getMolecules();
     82  TestList = new MoleculeListClass;
    7983  TestMolecule->ActiveFlag = true;
    8084  TestList->insert(TestMolecule);
     
    9498    delete(binmap);
    9599
     100  // remove
     101  delete(TestList);
    96102  // note that all the atoms are cleaned by TestMolecule
     103  delete(tafel);
     104  // note that element is cleaned by periodentafel
    97105  World::destroy();
     106  MemoryUsageObserver::purgeInstance();
     107  logger::purgeInstance();
     108  errorLogger::purgeInstance();
    98109};
    99110
     
    130141  CPPUNIT_ASSERT_EQUAL( 6, tester->second );
    131142};
    132 
    133 /********************************************** Main routine **************************************/
    134 
    135 int main(int argc, char **argv)
    136 {
    137   // Get the top level suite from the registry
    138   CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
    139 
    140   // Adds the test to the list of test to run
    141   CppUnit::TextUi::TestRunner runner;
    142   runner.addTest( suite );
    143 
    144   // Change the default outputter to a compiler error format outputter
    145   runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
    146                                                        std::cerr ) );
    147   // Run the tests.
    148   bool wasSucessful = runner.run();
    149 
    150   // Return error code 1 if the one of test failed.
    151   return wasSucessful ? 0 : 1;
    152 };
Note: See TracChangeset for help on using the changeset viewer.