Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp

    rcbc5fb re6fdbe  
    1717#include "AnalysisCorrelationToSurfaceUnitTest.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 **************************************/
     
    5660
    5761  // construct periodentafel
    58   tafel = World::get()->getPeriode();
     62  tafel = new periodentafel;
    5963  tafel->AddElement(hydrogen);
    6064  tafel->AddElement(carbon);
    6165
    6266  // construct molecule (tetraeder of hydrogens) base
    63   TestMolecule = World::get()->createMolecule();
    64   Walker = World::get()->createAtom();
     67  TestMolecule = new molecule(tafel);
     68  Walker = new atom();
    6569  Walker->type = hydrogen;
    6670  Walker->node->Init(1., 0., 1. );
    6771  TestMolecule->AddAtom(Walker);
    68   Walker = World::get()->createAtom();
     72  Walker = new atom();
    6973  Walker->type = hydrogen;
    7074  Walker->node->Init(0., 1., 1. );
    7175  TestMolecule->AddAtom(Walker);
    72   Walker = World::get()->createAtom();
     76  Walker = new atom();
    7377  Walker->type = hydrogen;
    7478  Walker->node->Init(1., 1., 0. );
    7579  TestMolecule->AddAtom(Walker);
    76   Walker = World::get()->createAtom();
     80  Walker = new atom();
    7781  Walker->type = hydrogen;
    7882  Walker->node->Init(0., 0., 0. );
     
    8286  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    8387
    84   TestList = World::get()->getMolecules();
     88  TestList = new MoleculeListClass;
    8589  TestMolecule->ActiveFlag = true;
    8690  TestList->insert(TestMolecule);
     
    9599
    96100  // add outer atoms
    97   Walker = World::get()->createAtom();
     101  Walker = new atom();
    98102  Walker->type = carbon;
    99103  Walker->node->Init(4., 0., 4. );
    100104  TestMolecule->AddAtom(Walker);
    101   Walker = World::get()->createAtom();
     105  Walker = new atom();
    102106  Walker->type = carbon;
    103107  Walker->node->Init(0., 4., 4. );
    104108  TestMolecule->AddAtom(Walker);
    105   Walker = World::get()->createAtom();
     109  Walker = new atom();
    106110  Walker->type = carbon;
    107111  Walker->node->Init(4., 4., 0. );
    108112  TestMolecule->AddAtom(Walker);
    109113  // add inner atoms
    110   Walker = World::get()->createAtom();
     114  Walker = new atom();
    111115  Walker->type = carbon;
    112116  Walker->node->Init(0.5, 0.5, 0.5 );
     
    127131    delete(binmap);
    128132
     133  // remove
     134  delete(TestList);
    129135  delete(Surface);
    130136  // note that all the atoms are cleaned by TestMolecule
    131137  delete(LC);
     138  delete(tafel);
     139  // note that element is cleaned by periodentafel
    132140  World::destroy();
     141  MemoryUsageObserver::purgeInstance();
     142  logger::purgeInstance();
    133143};
    134144
     
    209219
    210220};
    211 
    212 /********************************************** Main routine **************************************/
    213 
    214 int 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.