Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisPairCorrelationUnitTest.cpp

    re6fdbe rcbc5fb  
    1717#include "AnalysisPairCorrelationUnitTest.hpp"
    1818
     19#include "World.hpp"
    1920#include "atom.hpp"
    2021#include "boundary.hpp"
     
    2425#include "periodentafel.hpp"
    2526#include "tesselation.hpp"
    26 #include "World.hpp"
    27 
    28 #ifdef HAVE_TESTRUNNER
    29 #include "UnitTestMain.hpp"
    30 #endif /*HAVE_TESTRUNNER*/
    3127
    3228/********************************************** Test classes **************************************/
     
    5551
    5652  // construct periodentafel
    57   tafel = new periodentafel;
     53  tafel = World::get()->getPeriode();
    5854  tafel->AddElement(hydrogen);
    5955
    6056  // construct molecule (tetraeder of hydrogens)
    61   TestMolecule = new molecule(tafel);
    62   Walker = new atom();
     57  TestMolecule = World::get()->createMolecule();
     58  Walker = World::get()->createAtom();
    6359  Walker->type = hydrogen;
    6460  Walker->node->Init(1., 0., 1. );
    6561  TestMolecule->AddAtom(Walker);
    66   Walker = new atom();
     62  Walker = World::get()->createAtom();
    6763  Walker->type = hydrogen;
    6864  Walker->node->Init(0., 1., 1. );
    6965  TestMolecule->AddAtom(Walker);
    70   Walker = new atom();
     66  Walker = World::get()->createAtom();
    7167  Walker->type = hydrogen;
    7268  Walker->node->Init(1., 1., 0. );
    7369  TestMolecule->AddAtom(Walker);
    74   Walker = new atom();
     70  Walker = World::get()->createAtom();
    7571  Walker->type = hydrogen;
    7672  Walker->node->Init(0., 0., 0. );
     
    8076  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    8177
    82   TestList = new MoleculeListClass;
     78  TestList = World::get()->getMolecules();
    8379  TestMolecule->ActiveFlag = true;
    8480  TestList->insert(TestMolecule);
     
    9894    delete(binmap);
    9995
    100   // remove
    101   delete(TestList);
    10296  // note that all the atoms are cleaned by TestMolecule
    103   delete(tafel);
    104   // note that element is cleaned by periodentafel
    10597  World::destroy();
    106   MemoryUsageObserver::purgeInstance();
    107   logger::purgeInstance();
    108   errorLogger::purgeInstance();
    10998};
    11099
     
    141130  CPPUNIT_ASSERT_EQUAL( 6, tester->second );
    142131};
     132
     133/********************************************** Main routine **************************************/
     134
     135int 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.