Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/listofbondsunittest.cpp

    r46d958 re6fdbe  
    1616#include "listofbondsunittest.hpp"
    1717
    18 #include "World.hpp"
    1918#include "atom.hpp"
    2019#include "bond.hpp"
     
    2221#include "molecule.hpp"
    2322#include "periodentafel.hpp"
     23#include "World.hpp"
     24
     25#ifdef HAVE_TESTRUNNER
     26#include "UnitTestMain.hpp"
     27#endif /*HAVE_TESTRUNNER*/
    2428
    2529/********************************************** Test classes **************************************/
     
    5155  // construct molecule (tetraeder of hydrogens)
    5256  TestMolecule = new molecule(tafel);
    53   Walker = World::get()->createAtom();
     57  Walker = new atom();
    5458  Walker->type = hydrogen;
    5559  Walker->node->Init(1., 0., 1. );
    5660  TestMolecule->AddAtom(Walker);
    57   Walker = World::get()->createAtom();
     61  Walker = new atom();
    5862  Walker->type = hydrogen;
    5963  Walker->node->Init(0., 1., 1. );
    6064  TestMolecule->AddAtom(Walker);
    61   Walker = World::get()->createAtom();
     65  Walker = new atom();
    6266  Walker->type = hydrogen;
    6367  Walker->node->Init(1., 1., 0. );
    6468  TestMolecule->AddAtom(Walker);
    65   Walker = World::get()->createAtom();
     69  Walker = new atom();
    6670  Walker->type = hydrogen;
    6771  Walker->node->Init(0., 0., 0. );
     
    8185  delete(tafel);
    8286  // note that element is cleaned by periodentafel
     87  World::destroy();
     88  MemoryUsageObserver::purgeInstance();
     89  logger::purgeInstance();
    8390};
    8491
     
    243250
    244251  // remove atom2
    245   World::get()->destroyAtom(atom2);
     252  delete(atom2);
    246253
    247254  // check bond if removed from other atom
     
    251258  CPPUNIT_ASSERT_EQUAL( TestMolecule->first->next, TestMolecule->last );
    252259};
    253 
    254 /********************************************** Main routine **************************************/
    255 
    256 int 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.