Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/listofbondsunittest.cpp

    re6fdbe r46d958  
    1616#include "listofbondsunittest.hpp"
    1717
     18#include "World.hpp"
    1819#include "atom.hpp"
    1920#include "bond.hpp"
     
    2122#include "molecule.hpp"
    2223#include "periodentafel.hpp"
    23 #include "World.hpp"
    24 
    25 #ifdef HAVE_TESTRUNNER
    26 #include "UnitTestMain.hpp"
    27 #endif /*HAVE_TESTRUNNER*/
    2824
    2925/********************************************** Test classes **************************************/
     
    5551  // construct molecule (tetraeder of hydrogens)
    5652  TestMolecule = new molecule(tafel);
    57   Walker = new atom();
     53  Walker = World::get()->createAtom();
    5854  Walker->type = hydrogen;
    5955  Walker->node->Init(1., 0., 1. );
    6056  TestMolecule->AddAtom(Walker);
    61   Walker = new atom();
     57  Walker = World::get()->createAtom();
    6258  Walker->type = hydrogen;
    6359  Walker->node->Init(0., 1., 1. );
    6460  TestMolecule->AddAtom(Walker);
    65   Walker = new atom();
     61  Walker = World::get()->createAtom();
    6662  Walker->type = hydrogen;
    6763  Walker->node->Init(1., 1., 0. );
    6864  TestMolecule->AddAtom(Walker);
    69   Walker = new atom();
     65  Walker = World::get()->createAtom();
    7066  Walker->type = hydrogen;
    7167  Walker->node->Init(0., 0., 0. );
     
    8581  delete(tafel);
    8682  // note that element is cleaned by periodentafel
    87   World::destroy();
    88   MemoryUsageObserver::purgeInstance();
    89   logger::purgeInstance();
    9083};
    9184
     
    250243
    251244  // remove atom2
    252   delete(atom2);
     245  World::get()->destroyAtom(atom2);
    253246
    254247  // check bond if removed from other atom
     
    258251  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
    259252};
     253
     254/********************************************** Main routine **************************************/
     255
     256int main(int argc, char **argv)
     257{
     258  // Get the top level suite from the registry
     259  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
     260
     261  // Adds the test to the list of test to run
     262  CppUnit::TextUi::TestRunner runner;
     263  runner.addTest( suite );
     264
     265  // Change the default outputter to a compiler error format outputter
     266  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
     267                                                       std::cerr ) );
     268  // Run the tests.
     269  bool wasSucessful = runner.run();
     270
     271  // Return error code 1 if the one of test failed.
     272  return wasSucessful ? 0 : 1;
     273};
Note: See TracChangeset for help on using the changeset viewer.