Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    re6fdbe rcbc5fb  
    1717#include "AnalysisCorrelationToPointUnitTest.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 **************************************/
     
    5652
    5753  // construct periodentafel
    58   tafel = new periodentafel;
     54  tafel = World::get()->getPeriode();
    5955  tafel->AddElement(hydrogen);
    6056
    6157  // construct molecule (tetraeder of hydrogens)
    62   TestMolecule = new molecule(tafel);
    63   Walker = new atom();
     58  TestMolecule = World::get()->createMolecule();
     59  Walker = World::get()->createAtom();
    6460  Walker->type = hydrogen;
    6561  Walker->node->Init(1., 0., 1. );
    6662  TestMolecule->AddAtom(Walker);
    67   Walker = new atom();
     63  Walker = World::get()->createAtom();
    6864  Walker->type = hydrogen;
    6965  Walker->node->Init(0., 1., 1. );
    7066  TestMolecule->AddAtom(Walker);
    71   Walker = new atom();
     67  Walker = World::get()->createAtom();
    7268  Walker->type = hydrogen;
    7369  Walker->node->Init(1., 1., 0. );
    7470  TestMolecule->AddAtom(Walker);
    75   Walker = new atom();
     71  Walker = World::get()->createAtom();
    7672  Walker->type = hydrogen;
    7773  Walker->node->Init(0., 0., 0. );
     
    8177  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    8278
    83   TestList = new MoleculeListClass;
     79  TestList = World::get()->getMolecules();
    8480  TestMolecule->ActiveFlag = true;
    8581  TestList->insert(TestMolecule);
     
    10298    delete(binmap);
    10399
    104   // remove
    105   delete(TestList);
    106   // note that all the atoms are cleaned by TestMolecule
    107100  delete(point);
    108   delete(tafel);
    109   // note that element is cleaned by periodentafel
    110101  World::destroy();
    111   MemoryUsageObserver::purgeInstance();
    112   logger::purgeInstance();
    113102};
    114103
     
    148137
    149138};
     139
     140/********************************************** Main routine **************************************/
     141
     142int 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.