Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/unittests/bondgraphunittest.cpp

    re6fdbe read4e6  
    1616#include <cstring>
    1717
     18#include "World.hpp"
    1819#include "atom.hpp"
    1920#include "bond.hpp"
     
    5051  strcpy(hydrogen->symbol, "H");
    5152  carbon = new element;
    52   carbon->Z = 1;
     53  carbon->Z = 2;
    5354  strcpy(carbon->name, "carbon");
    5455  strcpy(carbon->symbol, "C");
     
    5657
    5758  // construct periodentafel
    58   tafel = new periodentafel;
     59  tafel = World::getInstance().getPeriode();
    5960  tafel->AddElement(hydrogen);
    6061  tafel->AddElement(carbon);
    6162
    6263  // construct molecule (tetraeder of hydrogens)
    63   TestMolecule = new molecule(tafel);
    64   Walker = new atom();
     64  TestMolecule = World::getInstance().createMolecule();
     65  Walker = World::getInstance().createAtom();
    6566  Walker->type = hydrogen;
    6667  Walker->node->Init(1., 0., 1. );
    6768  TestMolecule->AddAtom(Walker);
    68   Walker = new atom();
     69  Walker = World::getInstance().createAtom();
    6970  Walker->type = hydrogen;
    7071  Walker->node->Init(0., 1., 1. );
    7172  TestMolecule->AddAtom(Walker);
    72   Walker = new atom();
     73  Walker = World::getInstance().createAtom();
    7374  Walker->type = hydrogen;
    7475  Walker->node->Init(1., 1., 0. );
    7576  TestMolecule->AddAtom(Walker);
    76   Walker = new atom();
     77  Walker = World::getInstance().createAtom();
    7778  Walker->type = hydrogen;
    7879  Walker->node->Init(0., 0., 0. );
     
    101102
    102103  // remove molecule
    103   delete(TestMolecule);
    104   // note that all the atoms are cleaned by TestMolecule
    105   delete(tafel);
    106   // note that element is cleaned by periodentafel
    107   World::destroy();
     104  World::getInstance().destroyMolecule(TestMolecule);
     105  // note that all the atoms, molecules, the tafel and the elements
     106  // are all cleaned when the world is destroyed
     107  World::purgeInstance();
    108108  MemoryUsageObserver::purgeInstance();
    109109  logger::purgeInstance();
Note: See TracChangeset for help on using the changeset viewer.