Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    re6fdbe rcbc5fb  
    1717#include "AnalysisCorrelationToSurfaceUnitTest.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 **************************************/
     
    6056
    6157  // construct periodentafel
    62   tafel = new periodentafel;
     58  tafel = World::get()->getPeriode();
    6359  tafel->AddElement(hydrogen);
    6460  tafel->AddElement(carbon);
    6561
    6662  // construct molecule (tetraeder of hydrogens) base
    67   TestMolecule = new molecule(tafel);
    68   Walker = new atom();
     63  TestMolecule = World::get()->createMolecule();
     64  Walker = World::get()->createAtom();
    6965  Walker->type = hydrogen;
    7066  Walker->node->Init(1., 0., 1. );
    7167  TestMolecule->AddAtom(Walker);
    72   Walker = new atom();
     68  Walker = World::get()->createAtom();
    7369  Walker->type = hydrogen;
    7470  Walker->node->Init(0., 1., 1. );
    7571  TestMolecule->AddAtom(Walker);
    76   Walker = new atom();
     72  Walker = World::get()->createAtom();
    7773  Walker->type = hydrogen;
    7874  Walker->node->Init(1., 1., 0. );
    7975  TestMolecule->AddAtom(Walker);
    80   Walker = new atom();
     76  Walker = World::get()->createAtom();
    8177  Walker->type = hydrogen;
    8278  Walker->node->Init(0., 0., 0. );
     
    8682  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    8783
    88   TestList = new MoleculeListClass;
     84  TestList = World::get()->getMolecules();
    8985  TestMolecule->ActiveFlag = true;
    9086  TestList->insert(TestMolecule);
     
    9995
    10096  // add outer atoms
    101   Walker = new atom();
     97  Walker = World::get()->createAtom();
    10298  Walker->type = carbon;
    10399  Walker->node->Init(4., 0., 4. );
    104100  TestMolecule->AddAtom(Walker);
    105   Walker = new atom();
     101  Walker = World::get()->createAtom();
    106102  Walker->type = carbon;
    107103  Walker->node->Init(0., 4., 4. );
    108104  TestMolecule->AddAtom(Walker);
    109   Walker = new atom();
     105  Walker = World::get()->createAtom();
    110106  Walker->type = carbon;
    111107  Walker->node->Init(4., 4., 0. );
    112108  TestMolecule->AddAtom(Walker);
    113109  // add inner atoms
    114   Walker = new atom();
     110  Walker = World::get()->createAtom();
    115111  Walker->type = carbon;
    116112  Walker->node->Init(0.5, 0.5, 0.5 );
     
    131127    delete(binmap);
    132128
    133   // remove
    134   delete(TestList);
    135129  delete(Surface);
    136130  // note that all the atoms are cleaned by TestMolecule
    137131  delete(LC);
    138   delete(tafel);
    139   // note that element is cleaned by periodentafel
    140132  World::destroy();
    141   MemoryUsageObserver::purgeInstance();
    142   logger::purgeInstance();
    143133};
    144134
     
    219209
    220210};
     211
     212/********************************************** Main routine **************************************/
     213
     214int main(int argc, char **argv)
     215{
     216  // Get the top level suite from the registry
     217  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
     218
     219  // Adds the test to the list of test to run
     220  CppUnit::TextUi::TestRunner runner;
     221  runner.addTest( suite );
     222
     223  // Change the default outputter to a compiler error format outputter
     224  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
     225                                                       std::cerr ) );
     226  // Run the tests.
     227  bool wasSucessful = runner.run();
     228
     229  // Return error code 1 if the one of test failed.
     230  return wasSucessful ? 0 : 1;
     231};
Note: See TracChangeset for help on using the changeset viewer.