Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/AnalysisCorrelationToPointUnitTest.cpp

    r4eb4fe r3d9df5  
    1818
    1919#include "atom.hpp"
     20#include "boundary.hpp"
    2021#include "element.hpp"
    2122#include "molecule.hpp"
    2223#include "linkedcell.hpp"
    2324#include "periodentafel.hpp"
    24 #include "World.hpp"
    25 
    26 #ifdef HAVE_TESTRUNNER
    27 #include "UnitTestMain.hpp"
    28 #endif /*HAVE_TESTRUNNER*/
     25#include "tesselation.hpp"
    2926
    3027/********************************************** Test classes **************************************/
     
    4037  TestList = NULL;
    4138  TestMolecule = NULL;
     39  hydrogen = NULL;
     40  tafel = NULL;
    4241  pointmap = NULL;
    4342  binmap = NULL;
    4443  point = NULL;
    4544
     45  // construct element
     46  hydrogen = new element;
     47  hydrogen->Z = 1;
     48  strcpy(hydrogen->name, "hydrogen");
     49  strcpy(hydrogen->symbol, "H");
     50
     51
     52  // construct periodentafel
     53  tafel = new periodentafel;
     54  tafel->AddElement(hydrogen);
     55
    4656  // construct molecule (tetraeder of hydrogens)
    47   hydrogen = World::getInstance().getPeriode()->FindElement(1);
    48   CPPUNIT_ASSERT(hydrogen != NULL && "hydrogen element not found");
    49   TestMolecule = World::getInstance().createMolecule();
    50   Walker = World::getInstance().createAtom();
     57  TestMolecule = new molecule(tafel);
     58  Walker = new atom();
    5159  Walker->type = hydrogen;
    52   *Walker->node = Vector(1., 0., 1. );
     60  Walker->node->Init(1., 0., 1. );
    5361  TestMolecule->AddAtom(Walker);
    54   Walker = World::getInstance().createAtom();
     62  Walker = new atom();
    5563  Walker->type = hydrogen;
    56   *Walker->node = Vector(0., 1., 1. );
     64  Walker->node->Init(0., 1., 1. );
    5765  TestMolecule->AddAtom(Walker);
    58   Walker = World::getInstance().createAtom();
     66  Walker = new atom();
    5967  Walker->type = hydrogen;
    60   *Walker->node = Vector(1., 1., 0. );
     68  Walker->node->Init(1., 1., 0. );
    6169  TestMolecule->AddAtom(Walker);
    62   Walker = World::getInstance().createAtom();
     70  Walker = new atom();
    6371  Walker->type = hydrogen;
    64   *Walker->node = Vector(0., 0., 0. );
     72  Walker->node->Init(0., 0., 0. );
    6573  TestMolecule->AddAtom(Walker);
    6674
     
    6876  CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 );
    6977
    70   TestList = World::getInstance().getMolecules();
     78  TestList = new MoleculeListClass;
     79  TestMolecule->ActiveFlag = true;
    7180  TestList->insert(TestMolecule);
    72   TestMolecule->ActiveFlag = true;
    7381
    7482  // init point
     
    8997    delete(binmap);
    9098
     99  // remove
     100  delete(TestList);
     101  // note that all the atoms are cleaned by TestMolecule
    91102  delete(point);
    92   World::purgeInstance();
    93   MemoryUsageObserver::purgeInstance();
    94   logger::purgeInstance();
     103  delete(tafel);
     104  // note that element is cleaned by periodentafel
    95105};
    96106
     
    130140
    131141};
     142
     143/********************************************** Main routine **************************************/
     144
     145int main(int argc, char **argv)
     146{
     147  // Get the top level suite from the registry
     148  CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
     149
     150  // Adds the test to the list of test to run
     151  CppUnit::TextUi::TestRunner runner;
     152  runner.addTest( suite );
     153
     154  // Change the default outputter to a compiler error format outputter
     155  runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
     156                                                       std::cerr ) );
     157  // Run the tests.
     158  bool wasSucessful = runner.run();
     159
     160  // Return error code 1 if the one of test failed.
     161  return wasSucessful ? 0 : 1;
     162};
Note: See TracChangeset for help on using the changeset viewer.