Changeset 57f5cf for src/unittests
- Timestamp:
- Mar 4, 2010, 9:49:45 AM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- ab4b55
- Parents:
- 6bc51d (diff), 88d586 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/unittests
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
r6bc51d r57f5cf 17 17 #include "AnalysisCorrelationToPointUnitTest.hpp" 18 18 19 #include "World.hpp" 19 20 #include "atom.hpp" 20 21 #include "boundary.hpp" … … 56 57 57 58 // construct periodentafel 58 tafel = new periodentafel;59 tafel = World::get()->getPeriode(); 59 60 tafel->AddElement(hydrogen); 60 61 61 62 // construct molecule (tetraeder of hydrogens) 62 TestMolecule = new molecule(tafel);63 Walker = new atom();63 TestMolecule = World::get()->createMolecule(); 64 Walker = World::get()->createAtom(); 64 65 Walker->type = hydrogen; 65 66 Walker->node->Init(1., 0., 1. ); 66 67 TestMolecule->AddAtom(Walker); 67 Walker = new atom();68 Walker = World::get()->createAtom(); 68 69 Walker->type = hydrogen; 69 70 Walker->node->Init(0., 1., 1. ); 70 71 TestMolecule->AddAtom(Walker); 71 Walker = new atom();72 Walker = World::get()->createAtom(); 72 73 Walker->type = hydrogen; 73 74 Walker->node->Init(1., 1., 0. ); 74 75 TestMolecule->AddAtom(Walker); 75 Walker = new atom();76 Walker = World::get()->createAtom(); 76 77 Walker->type = hydrogen; 77 78 Walker->node->Init(0., 0., 0. ); … … 81 82 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 ); 82 83 83 TestList = new MoleculeListClass;84 TestList = World::get()->getMolecules(); 84 85 TestMolecule->ActiveFlag = true; 85 86 TestList->insert(TestMolecule); … … 102 103 delete(binmap); 103 104 104 // remove105 delete(TestList);106 // note that all the atoms are cleaned by TestMolecule107 105 delete(point); 108 delete(tafel);109 // note that element is cleaned by periodentafel110 106 World::destroy(); 111 107 MemoryUsageObserver::purgeInstance(); -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
r6bc51d r57f5cf 17 17 #include "AnalysisCorrelationToSurfaceUnitTest.hpp" 18 18 19 #include "World.hpp" 19 20 #include "atom.hpp" 20 21 #include "boundary.hpp" … … 60 61 61 62 // construct periodentafel 62 tafel = new periodentafel;63 tafel = World::get()->getPeriode(); 63 64 tafel->AddElement(hydrogen); 64 65 tafel->AddElement(carbon); 65 66 66 67 // construct molecule (tetraeder of hydrogens) base 67 TestMolecule = new molecule(tafel);68 Walker = new atom();68 TestMolecule = World::get()->createMolecule(); 69 Walker = World::get()->createAtom(); 69 70 Walker->type = hydrogen; 70 71 Walker->node->Init(1., 0., 1. ); 71 72 TestMolecule->AddAtom(Walker); 72 Walker = new atom();73 Walker = World::get()->createAtom(); 73 74 Walker->type = hydrogen; 74 75 Walker->node->Init(0., 1., 1. ); 75 76 TestMolecule->AddAtom(Walker); 76 Walker = new atom();77 Walker = World::get()->createAtom(); 77 78 Walker->type = hydrogen; 78 79 Walker->node->Init(1., 1., 0. ); 79 80 TestMolecule->AddAtom(Walker); 80 Walker = new atom();81 Walker = World::get()->createAtom(); 81 82 Walker->type = hydrogen; 82 83 Walker->node->Init(0., 0., 0. ); … … 86 87 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 ); 87 88 88 TestList = new MoleculeListClass;89 TestList = World::get()->getMolecules(); 89 90 TestMolecule->ActiveFlag = true; 90 91 TestList->insert(TestMolecule); … … 99 100 100 101 // add outer atoms 101 Walker = new atom();102 Walker = World::get()->createAtom(); 102 103 Walker->type = carbon; 103 104 Walker->node->Init(4., 0., 4. ); 104 105 TestMolecule->AddAtom(Walker); 105 Walker = new atom();106 Walker = World::get()->createAtom(); 106 107 Walker->type = carbon; 107 108 Walker->node->Init(0., 4., 4. ); 108 109 TestMolecule->AddAtom(Walker); 109 Walker = new atom();110 Walker = World::get()->createAtom(); 110 111 Walker->type = carbon; 111 112 Walker->node->Init(4., 4., 0. ); 112 113 TestMolecule->AddAtom(Walker); 113 114 // add inner atoms 114 Walker = new atom();115 Walker = World::get()->createAtom(); 115 116 Walker->type = carbon; 116 117 Walker->node->Init(0.5, 0.5, 0.5 ); … … 131 132 delete(binmap); 132 133 133 // remove134 delete(TestList);135 134 delete(Surface); 136 135 // note that all the atoms are cleaned by TestMolecule 137 136 delete(LC); 138 delete(tafel);139 // note that element is cleaned by periodentafel140 137 World::destroy(); 141 138 MemoryUsageObserver::purgeInstance(); -
src/unittests/AnalysisPairCorrelationUnitTest.cpp
r6bc51d r57f5cf 17 17 #include "AnalysisPairCorrelationUnitTest.hpp" 18 18 19 #include "World.hpp" 19 20 #include "atom.hpp" 20 21 #include "boundary.hpp" … … 55 56 56 57 // construct periodentafel 57 tafel = new periodentafel;58 tafel = World::get()->getPeriode(); 58 59 tafel->AddElement(hydrogen); 59 60 60 61 // construct molecule (tetraeder of hydrogens) 61 TestMolecule = new molecule(tafel);62 Walker = new atom();62 TestMolecule = World::get()->createMolecule(); 63 Walker = World::get()->createAtom(); 63 64 Walker->type = hydrogen; 64 65 Walker->node->Init(1., 0., 1. ); 65 66 TestMolecule->AddAtom(Walker); 66 Walker = new atom();67 Walker = World::get()->createAtom(); 67 68 Walker->type = hydrogen; 68 69 Walker->node->Init(0., 1., 1. ); 69 70 TestMolecule->AddAtom(Walker); 70 Walker = new atom();71 Walker = World::get()->createAtom(); 71 72 Walker->type = hydrogen; 72 73 Walker->node->Init(1., 1., 0. ); 73 74 TestMolecule->AddAtom(Walker); 74 Walker = new atom();75 Walker = World::get()->createAtom(); 75 76 Walker->type = hydrogen; 76 77 Walker->node->Init(0., 0., 0. ); … … 80 81 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 4 ); 81 82 82 TestList = new MoleculeListClass;83 TestList = World::get()->getMolecules(); 83 84 TestMolecule->ActiveFlag = true; 84 85 TestList->insert(TestMolecule); … … 98 99 delete(binmap); 99 100 100 // remove101 delete(TestList);102 101 // note that all the atoms are cleaned by TestMolecule 103 delete(tafel);104 // note that element is cleaned by periodentafel105 102 World::destroy(); 106 103 MemoryUsageObserver::purgeInstance(); -
src/unittests/DescriptorUnittest.cpp
r6bc51d r57f5cf 27 27 CPPUNIT_TEST_SUITE_REGISTRATION( DescriptorUnittest ); 28 28 29 // some stubs30 class AtomStub : public atom {31 public:32 AtomStub(int _id) :33 atom(),34 id(_id)35 {}36 37 virtual int getId(){38 return id;39 }40 41 private:42 int id;43 };44 45 46 29 // set up and tear down 47 30 void DescriptorUnittest::setUp(){ 48 31 World::get(); 49 32 for(int i=0;i<ATOM_COUNT;++i){ 50 atoms[i]= new AtomStub(i); 33 atoms[i]= World::get()->createAtom(); 34 atomIds[i] = atoms[i]->getId(); 51 35 } 52 36 } 53 37 void DescriptorUnittest::tearDown(){ 54 38 World::destroy(); 55 for(int i=0;i<ATOM_COUNT;++i){56 delete atoms[i];57 }58 39 } 59 40 60 41 // some helper functions 61 bool hasAll(std::vector<atom*> atoms,int min, int max, std::set<int> excluded = std::set<int>()){ 62 for(int i=min;i<max;++i){ 63 if(!excluded.count(i)){ 42 bool hasAll(std::vector<atom*> atoms,int ids[ATOM_COUNT], std::set<int> excluded = std::set<int>()){ 43 for(int i=0;i<ATOM_COUNT;++i){ 44 int id = ids[i]; 45 if(!excluded.count(id)){ 64 46 std::vector<atom*>::iterator iter; 65 47 bool res=false; 66 48 for(iter=atoms.begin();iter!=atoms.end();++iter){ 67 res |= (*iter)->getId() == i ;49 res |= (*iter)->getId() == id; 68 50 } 69 51 if(!res) { 70 cout << "Atom " << i << " missing in returned list" << endl;52 cout << "Atom " << id << " missing in returned list" << endl; 71 53 return false; 72 54 } … … 91 73 void DescriptorUnittest::AtomBaseSetsTest(){ 92 74 std::vector<atom*> allAtoms = World::get()->getAllAtoms(AllAtoms()); 93 CPPUNIT_ASSERT_EQUAL( true , hasAll(allAtoms, 0,ATOM_COUNT));75 CPPUNIT_ASSERT_EQUAL( true , hasAll(allAtoms,atomIds)); 94 76 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(allAtoms)); 95 77 … … 100 82 // test Atoms from boundaries and middle of the set 101 83 atom* testAtom; 102 testAtom = World::get()->getAtom(AtomById(0)); 103 CPPUNIT_ASSERT_EQUAL( 0, testAtom->getId()); 104 testAtom = World::get()->getAtom(AtomById(ATOM_COUNT/2)); 105 CPPUNIT_ASSERT_EQUAL( ATOM_COUNT/2, testAtom->getId()); 106 testAtom = World::get()->getAtom(AtomById(ATOM_COUNT-1)); 107 CPPUNIT_ASSERT_EQUAL( ATOM_COUNT-1, testAtom->getId()); 84 testAtom = World::get()->getAtom(AtomById(atomIds[0])); 85 CPPUNIT_ASSERT(testAtom); 86 CPPUNIT_ASSERT_EQUAL( atomIds[0], testAtom->getId()); 87 testAtom = World::get()->getAtom(AtomById(atomIds[ATOM_COUNT/2])); 88 CPPUNIT_ASSERT(testAtom); 89 CPPUNIT_ASSERT_EQUAL( atomIds[ATOM_COUNT/2], testAtom->getId()); 90 testAtom = World::get()->getAtom(AtomById(atomIds[ATOM_COUNT-1])); 91 CPPUNIT_ASSERT(testAtom); 92 CPPUNIT_ASSERT_EQUAL( atomIds[ATOM_COUNT-1], testAtom->getId()); 108 93 94 // find some ID that has not been created 95 int outsideId =-1; 96 bool res = false; 97 while(!res) { 98 ++outsideId; 99 res = true; 100 for(int i = 0; i < ATOM_COUNT; ++i){ 101 res &= atomIds[i]!=outsideId; 102 } 103 } 109 104 // test from outside of set 110 testAtom = World::get()->getAtom(AtomById( ATOM_COUNT));105 testAtom = World::get()->getAtom(AtomById(outsideId)); 111 106 CPPUNIT_ASSERT(!testAtom); 112 107 } … … 115 110 { 116 111 std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()||NoAtoms()); 117 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms, 0,ATOM_COUNT));112 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds)); 118 113 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms)); 119 114 } … … 121 116 { 122 117 std::vector<atom*> testAtoms = World::get()->getAllAtoms(NoAtoms()||AllAtoms()); 123 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms, 0,ATOM_COUNT));118 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds)); 124 119 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms)); 125 120 } … … 142 137 { 143 138 std::vector<atom*> testAtoms = World::get()->getAllAtoms(!NoAtoms()); 144 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms, 0,ATOM_COUNT));139 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds)); 145 140 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms)); 146 141 } … … 148 143 // exclude and include some atoms 149 144 { 150 std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()&&(!AtomById( ATOM_COUNT/2)));145 std::vector<atom*> testAtoms = World::get()->getAllAtoms(AllAtoms()&&(!AtomById(atomIds[ATOM_COUNT/2]))); 151 146 std::set<int> excluded; 152 excluded.insert( ATOM_COUNT/2);153 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms, 0,ATOM_COUNT,excluded));147 excluded.insert(atomIds[ATOM_COUNT/2]); 148 CPPUNIT_ASSERT_EQUAL( true , hasAll(testAtoms,atomIds,excluded)); 154 149 CPPUNIT_ASSERT_EQUAL( true , hasNoDuplicates(testAtoms)); 155 150 CPPUNIT_ASSERT_EQUAL( (size_t)(ATOM_COUNT-1), testAtoms.size()); … … 157 152 158 153 { 159 std::vector<atom*> testAtoms = World::get()->getAllAtoms(NoAtoms()||(AtomById( ATOM_COUNT/2)));154 std::vector<atom*> testAtoms = World::get()->getAllAtoms(NoAtoms()||(AtomById(atomIds[ATOM_COUNT/2]))); 160 155 CPPUNIT_ASSERT_EQUAL( (size_t)1, testAtoms.size()); 161 CPPUNIT_ASSERT_EQUAL( ATOM_COUNT/2, testAtoms[0]->getId());156 CPPUNIT_ASSERT_EQUAL( atomIds[ATOM_COUNT/2], testAtoms[0]->getId()); 162 157 } 163 158 } -
src/unittests/DescriptorUnittest.hpp
r6bc51d r57f5cf 33 33 private: 34 34 atom *atoms [ATOM_COUNT]; 35 int atomIds [ATOM_COUNT]; 35 36 }; 36 37 -
src/unittests/Makefile.am
r6bc51d r57f5cf 31 31 DescriptorUnittest \ 32 32 MatrixUnitTest \ 33 manipulateAtomsTest \ 34 atomsCalculationTest \ 33 35 ${MENUTESTS} 34 36 … … 61 63 tesselation_insideoutsideunittest.cpp \ 62 64 vectorunittest.cpp \ 63 ActionSequenceTest.cpp \64 65 ObserverTest.cpp \ 65 66 CacheableTest.cpp \ 66 67 DescriptorUnittest.cpp \ 67 MatrixUnitTest.cpp 68 MatrixUnitTest.cpp \ 69 manipulateAtomsTest.cpp \ 70 atomsCalculationTest.cpp \ 71 ActionSequenceTest.cpp 68 72 69 73 TESTHEADERS = \ … … 145 149 MatrixUnitTest_LDADD = ${ALLLIBS} 146 150 151 manipulateAtomsTest_SOURCES = UnitTestMain.cpp manipulateAtomsTest.cpp manipulateAtomsTest.hpp 152 manipulateAtomsTest_LDADD = ${ALLLIBS} 153 154 atomsCalculationTest_SOURCES = UnitTestMain.cpp atomsCalculationTest.cpp atomsCalculationTest.hpp 155 atomsCalculationTest_LDADD = ${ALLLIBS} 156 147 157 TestRunner_SOURCES = TestRunnerMain.cpp $(TESTSOURCES) $(TESTHEADERS) 148 158 TestRunner_LDADD = ${ALLLIBS} -
src/unittests/analysisbondsunittest.cpp
r6bc51d r57f5cf 16 16 #include <cstring> 17 17 18 #include "World.hpp" 18 19 #include "analysis_bonds.hpp" 19 20 #include "analysisbondsunittest.hpp" … … 60 61 61 62 // construct periodentafel 62 tafel = new periodentafel;63 tafel = World::get()->getPeriode(); 63 64 tafel->AddElement(hydrogen); 64 65 tafel->AddElement(carbon); 65 66 66 67 // construct molecule (tetraeder of hydrogens) 67 TestMolecule = new molecule(tafel);68 Walker = new atom();68 TestMolecule = World::get()->createMolecule(); 69 Walker = World::get()->createAtom(); 69 70 Walker->type = hydrogen; 70 71 Walker->node->Init(1.5, 0., 1.5 ); 71 72 TestMolecule->AddAtom(Walker); 72 Walker = new atom();73 Walker = World::get()->createAtom(); 73 74 Walker->type = hydrogen; 74 75 Walker->node->Init(0., 1.5, 1.5 ); 75 76 TestMolecule->AddAtom(Walker); 76 Walker = new atom();77 Walker = World::get()->createAtom(); 77 78 Walker->type = hydrogen; 78 79 Walker->node->Init(1.5, 1.5, 0. ); 79 80 TestMolecule->AddAtom(Walker); 80 Walker = new atom();81 Walker = World::get()->createAtom(); 81 82 Walker->type = hydrogen; 82 83 Walker->node->Init(0., 0., 0. ); 83 84 TestMolecule->AddAtom(Walker); 84 Walker = new atom();85 Walker = World::get()->createAtom(); 85 86 Walker->type = carbon; 86 87 Walker->node->Init(0.5, 0.5, 0.5 ); … … 116 117 117 118 // remove molecule 118 delete(TestMolecule);119 World::get()->destroyMolecule(TestMolecule); 119 120 // note that all the atoms are cleaned by TestMolecule 120 delete(tafel); 121 // note that element is cleaned by periodentafel 121 World::destroy(); 122 122 }; 123 123 -
src/unittests/bondgraphunittest.cpp
r6bc51d r57f5cf 16 16 #include <cstring> 17 17 18 #include "World.hpp" 18 19 #include "atom.hpp" 19 20 #include "bond.hpp" … … 56 57 57 58 // construct periodentafel 58 tafel = new periodentafel;59 tafel = World::get()->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::get()->createMolecule(); 65 Walker = World::get()->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::get()->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::get()->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::get()->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 104 World::get()->destroyMolecule(TestMolecule); 105 // note that all the atoms, molecules, the tafel and the elements 106 // are all cleaned when the world is destroyed 107 107 World::destroy(); 108 108 MemoryUsageObserver::purgeInstance(); -
src/unittests/listofbondsunittest.cpp
r6bc51d r57f5cf 16 16 #include "listofbondsunittest.hpp" 17 17 18 #include "World.hpp" 18 19 #include "atom.hpp" 19 20 #include "bond.hpp" … … 50 51 51 52 // construct periodentafel 52 tafel = new periodentafel;53 tafel = World::get()->getPeriode(); 53 54 tafel->AddElement(hydrogen); 54 55 55 56 // construct molecule (tetraeder of hydrogens) 56 TestMolecule = new molecule(tafel);57 Walker = new atom();57 TestMolecule = World::get()->createMolecule(); 58 Walker = World::get()->createAtom(); 58 59 Walker->type = hydrogen; 59 60 Walker->node->Init(1., 0., 1. ); 60 61 TestMolecule->AddAtom(Walker); 61 Walker = new atom();62 Walker = World::get()->createAtom(); 62 63 Walker->type = hydrogen; 63 64 Walker->node->Init(0., 1., 1. ); 64 65 TestMolecule->AddAtom(Walker); 65 Walker = new atom();66 Walker = World::get()->createAtom(); 66 67 Walker->type = hydrogen; 67 68 Walker->node->Init(1., 1., 0. ); 68 69 TestMolecule->AddAtom(Walker); 69 Walker = new atom();70 Walker = World::get()->createAtom(); 70 71 Walker->type = hydrogen; 71 72 Walker->node->Init(0., 0., 0. ); … … 81 82 { 82 83 // remove 83 delete(TestMolecule); 84 // note that all the atoms are cleaned by TestMolecule 85 delete(tafel); 86 // note that element is cleaned by periodentafel 84 World::get()->destroyMolecule(TestMolecule); 85 // note that all the atoms, molecules, the tafel and the elements 86 // are all cleaned when the world is destroyed 87 87 World::destroy(); 88 88 MemoryUsageObserver::purgeInstance(); … … 250 250 251 251 // remove atom2 252 delete(atom2);252 World::get()->destroyAtom(atom2); 253 253 254 254 // check bond if removed from other atom
Note:
See TracChangeset
for help on using the changeset viewer.