- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/bondgraphunittest.cpp
re6fdbe read4e6 16 16 #include <cstring> 17 17 18 #include "World.hpp" 18 19 #include "atom.hpp" 19 20 #include "bond.hpp" … … 50 51 strcpy(hydrogen->symbol, "H"); 51 52 carbon = new element; 52 carbon->Z = 1;53 carbon->Z = 2; 53 54 strcpy(carbon->name, "carbon"); 54 55 strcpy(carbon->symbol, "C"); … … 56 57 57 58 // construct periodentafel 58 tafel = new periodentafel;59 tafel = World::getInstance().getPeriode(); 59 60 tafel->AddElement(hydrogen); 60 61 tafel->AddElement(carbon); 61 62 62 63 // construct molecule (tetraeder of hydrogens) 63 TestMolecule = new molecule(tafel);64 Walker = new atom();64 TestMolecule = World::getInstance().createMolecule(); 65 Walker = World::getInstance().createAtom(); 65 66 Walker->type = hydrogen; 66 67 Walker->node->Init(1., 0., 1. ); 67 68 TestMolecule->AddAtom(Walker); 68 Walker = new atom();69 Walker = World::getInstance().createAtom(); 69 70 Walker->type = hydrogen; 70 71 Walker->node->Init(0., 1., 1. ); 71 72 TestMolecule->AddAtom(Walker); 72 Walker = new atom();73 Walker = World::getInstance().createAtom(); 73 74 Walker->type = hydrogen; 74 75 Walker->node->Init(1., 1., 0. ); 75 76 TestMolecule->AddAtom(Walker); 76 Walker = new atom();77 Walker = World::getInstance().createAtom(); 77 78 Walker->type = hydrogen; 78 79 Walker->node->Init(0., 0., 0. ); … … 101 102 102 103 // 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(); 108 108 MemoryUsageObserver::purgeInstance(); 109 109 logger::purgeInstance();
Note:
See TracChangeset
for help on using the changeset viewer.