Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/analysisbondsunittest.cpp

    r9b6b2f rcbc5fb  
    1616#include <cstring>
    1717
     18#include "World.hpp"
    1819#include "analysis_bonds.hpp"
    1920#include "analysisbondsunittest.hpp"
     
    2425#include "molecule.hpp"
    2526#include "periodentafel.hpp"
    26 
    27 #ifdef HAVE_TESTRUNNER
    28 #include "UnitTestMain.hpp"
    29 #endif /*HAVE_TESTRUNNER*/
    3027
    3128/********************************************** Test classes **************************************/
     
    6057
    6158  // construct periodentafel
    62   tafel = new periodentafel;
     59  tafel = World::get()->getPeriode();
    6360  tafel->AddElement(hydrogen);
    6461  tafel->AddElement(carbon);
    6562
    6663  // construct molecule (tetraeder of hydrogens)
    67   TestMolecule = new molecule(tafel);
    68   Walker = new atom();
     64  TestMolecule = World::get()->createMolecule();
     65  Walker = World::get()->createAtom();
    6966  Walker->type = hydrogen;
    7067  Walker->node->Init(1.5, 0., 1.5 );
    7168  TestMolecule->AddAtom(Walker);
    72   Walker = new atom();
     69  Walker = World::get()->createAtom();
    7370  Walker->type = hydrogen;
    7471  Walker->node->Init(0., 1.5, 1.5 );
    7572  TestMolecule->AddAtom(Walker);
    76   Walker = new atom();
     73  Walker = World::get()->createAtom();
    7774  Walker->type = hydrogen;
    7875  Walker->node->Init(1.5, 1.5, 0. );
    7976  TestMolecule->AddAtom(Walker);
    80   Walker = new atom();
     77  Walker = World::get()->createAtom();
    8178  Walker->type = hydrogen;
    8279  Walker->node->Init(0., 0., 0. );
    8380  TestMolecule->AddAtom(Walker);
    84   Walker = new atom();
     81  Walker = World::get()->createAtom();
    8582  Walker->type = carbon;
    8683  Walker->node->Init(0.5, 0.5, 0.5 );
     
    116113
    117114  // remove molecule
    118   delete(TestMolecule);
     115  World::get()->destroyMolecule(TestMolecule);
    119116  // note that all the atoms are cleaned by TestMolecule
    120   delete(tafel);
    121   // note that element is cleaned by periodentafel
     117  World::destroy();
    122118};
    123119
     
    167163  CPPUNIT_ASSERT_EQUAL( 0. , Max );
    168164};
     165
     166
     167/********************************************** Main routine **************************************/
     168
     169int main(int argc, char **argv)
     170{
     171  // Get the top level suite from the registry
     172  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
     173
     174  // Adds the test to the list of test to run
     175  CppUnit::TextUi::TestRunner runner;
     176  runner.addTest( suite );
     177
     178  // Change the default outputter to a compiler error format outputter
     179  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
     180                                                       std::cerr ) );
     181  // Run the tests.
     182  bool wasSucessful = runner.run();
     183
     184  // Return error code 1 if the one of test failed.
     185  return wasSucessful ? 0 : 1;
     186};
Note: See TracChangeset for help on using the changeset viewer.