Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/analysisbondsunittest.cpp

    rcbc5fb r9b6b2f  
    1616#include <cstring>
    1717
    18 #include "World.hpp"
    1918#include "analysis_bonds.hpp"
    2019#include "analysisbondsunittest.hpp"
     
    2524#include "molecule.hpp"
    2625#include "periodentafel.hpp"
     26
     27#ifdef HAVE_TESTRUNNER
     28#include "UnitTestMain.hpp"
     29#endif /*HAVE_TESTRUNNER*/
    2730
    2831/********************************************** Test classes **************************************/
     
    5760
    5861  // construct periodentafel
    59   tafel = World::get()->getPeriode();
     62  tafel = new periodentafel;
    6063  tafel->AddElement(hydrogen);
    6164  tafel->AddElement(carbon);
    6265
    6366  // construct molecule (tetraeder of hydrogens)
    64   TestMolecule = World::get()->createMolecule();
    65   Walker = World::get()->createAtom();
     67  TestMolecule = new molecule(tafel);
     68  Walker = new atom();
    6669  Walker->type = hydrogen;
    6770  Walker->node->Init(1.5, 0., 1.5 );
    6871  TestMolecule->AddAtom(Walker);
    69   Walker = World::get()->createAtom();
     72  Walker = new atom();
    7073  Walker->type = hydrogen;
    7174  Walker->node->Init(0., 1.5, 1.5 );
    7275  TestMolecule->AddAtom(Walker);
    73   Walker = World::get()->createAtom();
     76  Walker = new atom();
    7477  Walker->type = hydrogen;
    7578  Walker->node->Init(1.5, 1.5, 0. );
    7679  TestMolecule->AddAtom(Walker);
    77   Walker = World::get()->createAtom();
     80  Walker = new atom();
    7881  Walker->type = hydrogen;
    7982  Walker->node->Init(0., 0., 0. );
    8083  TestMolecule->AddAtom(Walker);
    81   Walker = World::get()->createAtom();
     84  Walker = new atom();
    8285  Walker->type = carbon;
    8386  Walker->node->Init(0.5, 0.5, 0.5 );
     
    113116
    114117  // remove molecule
    115   World::get()->destroyMolecule(TestMolecule);
     118  delete(TestMolecule);
    116119  // note that all the atoms are cleaned by TestMolecule
    117   World::destroy();
     120  delete(tafel);
     121  // note that element is cleaned by periodentafel
    118122};
    119123
     
    163167  CPPUNIT_ASSERT_EQUAL( 0. , Max );
    164168};
    165 
    166 
    167 /********************************************** Main routine **************************************/
    168 
    169 int 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.