Changeset 1024cb for src/unittests
- Timestamp:
- May 31, 2010, 5:32:27 PM (15 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:
- e08c46
- Parents:
- 42af9e (diff), a7b761b (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. - git-author:
- Frederik Heber <heber@…> (05/31/10 17:29:30)
- git-committer:
- Frederik Heber <heber@…> (05/31/10 17:32:27)
- Location:
- src/unittests
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/AnalysisCorrelationToPointUnitTest.cpp
r42af9e r1024cb 66 66 67 67 // check that TestMolecule was correctly constructed 68 CPPUNIT_ASSERT_EQUAL( TestMolecule-> AtomCount, 4 );68 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 69 69 70 70 TestList = World::getInstance().getMolecules(); -
src/unittests/AnalysisCorrelationToSurfaceUnitTest.cpp
r42af9e r1024cb 25 25 #include "tesselation.hpp" 26 26 #include "World.hpp" 27 #include "Helpers/Assert.hpp" 27 28 28 29 #include "Helpers/Assert.hpp" … … 39 40 void AnalysisCorrelationToSurfaceUnitTest::setUp() 40 41 { 41 //ASSERT_DO(Assert::Throw);42 ASSERT_DO(Assert::Throw); 42 43 43 44 atom *Walker = NULL; … … 54 55 hydrogen = World::getInstance().getPeriode()->FindElement(1); 55 56 TestSurfaceMolecule = World::getInstance().createMolecule(); 57 56 58 Walker = World::getInstance().createAtom(); 57 59 Walker->type = hydrogen; 58 60 *Walker->node = Vector(1., 0., 1. ); 59 60 TestSurfaceMolecule->AddAtom(Walker); 61 TestSurfaceMolecule->AddAtom(Walker); 62 61 63 Walker = World::getInstance().createAtom(); 62 64 Walker->type = hydrogen; 63 65 *Walker->node = Vector(0., 1., 1. ); 64 66 TestSurfaceMolecule->AddAtom(Walker); 67 65 68 Walker = World::getInstance().createAtom(); 66 69 Walker->type = hydrogen; 67 70 *Walker->node = Vector(1., 1., 0. ); 68 71 TestSurfaceMolecule->AddAtom(Walker); 72 69 73 Walker = World::getInstance().createAtom(); 70 74 Walker->type = hydrogen; … … 73 77 74 78 // check that TestMolecule was correctly constructed 75 CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule-> AtomCount, 4 );79 CPPUNIT_ASSERT_EQUAL( TestSurfaceMolecule->getAtomCount(), 4 ); 76 80 77 81 TestList = World::getInstance().getMolecules(); … … 91 95 *Walker->node = Vector(4., 0., 4. ); 92 96 TestSurfaceMolecule->AddAtom(Walker); 97 93 98 Walker = World::getInstance().createAtom(); 94 99 Walker->type = carbon; 95 100 *Walker->node = Vector(0., 4., 4. ); 96 101 TestSurfaceMolecule->AddAtom(Walker); 102 97 103 Walker = World::getInstance().createAtom(); 98 104 Walker->type = carbon; 99 105 *Walker->node = Vector(4., 4., 0. ); 100 106 TestSurfaceMolecule->AddAtom(Walker); 107 101 108 // add inner atoms 102 109 Walker = World::getInstance().createAtom(); … … 104 111 *Walker->node = Vector(0.5, 0.5, 0.5 ); 105 112 TestSurfaceMolecule->AddAtom(Walker); 113 106 114 TestSurfaceMolecule->ActiveFlag = true; 107 115 TestList->insert(TestSurfaceMolecule); … … 133 141 void AnalysisCorrelationToSurfaceUnitTest::SurfaceTest() 134 142 { 135 CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule-> AtomCount);143 CPPUNIT_ASSERT_EQUAL( 4, TestSurfaceMolecule->getAtomCount() ); 136 144 CPPUNIT_ASSERT_EQUAL( (size_t)2, TestList->ListOfMolecules.size() ); 137 145 CPPUNIT_ASSERT_EQUAL( (size_t)4, Surface->PointsOnBoundary.size() ); -
src/unittests/AnalysisPairCorrelationUnitTest.cpp
r42af9e r1024cb 68 68 69 69 // check that TestMolecule was correctly constructed 70 CPPUNIT_ASSERT_EQUAL( TestMolecule-> AtomCount, 4 );70 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 71 71 72 72 TestList = World::getInstance().getMolecules(); -
src/unittests/CountBondsUnitTest.cpp
r42af9e r1024cb 92 92 93 93 // check that TestMolecule was correctly constructed 94 CPPUNIT_ASSERT_EQUAL( TestMolecule1->AtomCount, 3 ); 95 Walker = TestMolecule1->start->next; 96 CPPUNIT_ASSERT( TestMolecule1->end != Walker ); 97 CPPUNIT_ASSERT_EQUAL( TestMolecule2->AtomCount, 3 ); 98 Walker = TestMolecule2->start->next; 99 CPPUNIT_ASSERT( TestMolecule2->end != Walker ); 94 CPPUNIT_ASSERT_EQUAL( TestMolecule1->getAtomCount(), 3 ); 95 CPPUNIT_ASSERT_EQUAL( TestMolecule2->getAtomCount(), 3 ); 100 96 101 97 // create a small file with table -
src/unittests/LinkedCellUnitTest.cpp
r42af9e r1024cb 60 60 61 61 // check that TestMolecule was correctly constructed 62 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 3*3*3 ); 63 Walker = TestMolecule->start->next; 64 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 62 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 3*3*3 ); 65 63 }; 66 64 … … 187 185 { 188 186 // check all atoms 189 atom *Walker = TestMolecule->start; 190 while (Walker->next != TestMolecule->end) { 191 Walker = Walker->next; 192 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(Walker) ); 187 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end();++iter){ 188 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(*iter) ); 193 189 } 194 190 195 191 // check internal vectors, returns false, because this atom is not in LC-list! 196 Walker= World::getInstance().createAtom();197 Walker->setName("test");198 Walker->x= Vector(1,1,1);199 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode( Walker) );200 World::getInstance().destroyAtom( Walker);192 atom *newAtom = World::getInstance().createAtom(); 193 newAtom->setName("test"); 194 newAtom->x= Vector(1,1,1); 195 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); 196 World::getInstance().destroyAtom(newAtom); 201 197 202 198 // check out of bounds vectors 203 Walker= World::getInstance().createAtom();204 Walker->setName("test");205 Walker->x = Vector(0,-1,0);206 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode( Walker) );207 World::getInstance().destroyAtom( Walker);199 newAtom = World::getInstance().createAtom(); 200 newAtom->setName("test"); 201 newAtom->x = Vector(0,-1,0); 202 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); 203 World::getInstance().destroyAtom(newAtom); 208 204 }; 209 205 … … 277 273 size = ListOfPoints->size(); 278 274 CPPUNIT_ASSERT_EQUAL( (size_t)27, size ); 279 Walker = TestMolecule->start; 280 Walker = TestMolecule->start; 281 while (Walker->next != TestMolecule->end) { 282 Walker = Walker->next; 283 ListOfPoints->remove(Walker); 275 276 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ 277 ListOfPoints->remove((*iter)); 284 278 size--; 285 279 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); … … 296 290 size=ListOfPoints->size(); 297 291 CPPUNIT_ASSERT_EQUAL( (size_t)8, size ); 298 Walker = TestMolecule->start; 299 while (Walker->next != TestMolecule->end) { 300 Walker = Walker->next; 301 if ((Walker->x[0] <2) && (Walker->x[1] <2) && (Walker->x[2] <2)) { 302 ListOfPoints->remove(Walker); 292 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ 293 if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) { 294 ListOfPoints->remove(*iter); 303 295 size--; 304 296 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); … … 316 308 size=ListOfPoints->size(); 317 309 CPPUNIT_ASSERT_EQUAL( (size_t)27, size ); 318 Walker = TestMolecule->start; 319 while (Walker->next != TestMolecule->end) { 320 Walker = Walker->next; 321 ListOfPoints->remove(Walker); 310 for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ 311 ListOfPoints->remove(*iter); 322 312 size--; 323 313 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); … … 345 335 size = ListOfPoints->size(); 346 336 CPPUNIT_ASSERT_EQUAL( (size_t)7, size ); 347 Walker = TestMolecule->start; 348 while (Walker->next != TestMolecule->end) { 349 Walker = Walker->next; 350 if ((Walker->x.DistanceSquared(tester) - 1.) < MYEPSILON ) { 351 ListOfPoints->remove(Walker); 337 for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ 338 if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) { 339 ListOfPoints->remove(*iter); 352 340 size--; 353 341 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); -
src/unittests/Makefile.am
r42af9e r1024cb 49 49 noinst_PROGRAMS = $(TESTS) TestRunner 50 50 51 GSLLIBS = ../libgslwrapper.a 52 ALLLIBS = ../libmolecuilder.a ${GSLLIBS} $(BOOST_LIB) ${BOOST_THREAD_LIB}51 GSLLIBS = ../libgslwrapper.a $(BOOST_LIB) ${BOOST_THREAD_LIB} 52 ALLLIBS = ../libmolecuilder.a ${GSLLIBS} 53 53 54 54 TESTSOURCES = \ … … 182 182 manipulateAtomsTest_LDADD = ${ALLLIBS} 183 183 184 MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp ../memoryallocator.hpp ../memory usageobserver.cpp ../memoryusageobserver.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp184 MemoryAllocatorUnitTest_SOURCES = UnitTestMain.cpp ../memoryallocator.hpp ../memoryallocator.cpp ../memoryusageobserver.cpp ../memoryusageobserver.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp 185 185 MemoryAllocatorUnitTest_LDADD = ${ALLLIBS} 186 186 … … 218 218 Tesselation_InOutsideUnitTest_LDADD = ${ALLLIBS} 219 219 220 TestRunner_SOURCES = TestRunnerMain.cpp ../memoryallocator.hpp ../memory usageobserver.cpp ../memoryusageobserver.hpp $(TESTSOURCES) $(TESTHEADERS)220 TestRunner_SOURCES = TestRunnerMain.cpp ../memoryallocator.hpp ../memoryallocator.cpp ../memoryusageobserver.cpp ../memoryusageobserver.hpp $(TESTSOURCES) $(TESTHEADERS) 221 221 TestRunner_LDADD = ${ALLLIBS} 222 222 -
src/unittests/ObserverTest.cpp
r42af9e r1024cb 11 11 #include <cppunit/extensions/TestFactoryRegistry.h> 12 12 #include <cppunit/ui/text/TestRunner.h> 13 #include <set> 13 14 14 15 #include "Patterns/Observer.hpp" 16 #include "Patterns/ObservedIterator.hpp" 15 17 #include "Helpers/Assert.hpp" 16 18 … … 162 164 bool wasNotified; 163 165 }; 166 167 class ObservableCollection : public Observable { 168 public: 169 typedef std::set<SimpleObservable*> set; 170 typedef ObservedIterator<set> iterator; 171 typedef set::const_iterator const_iterator; 172 173 ObservableCollection(int _num) : 174 num(_num) 175 { 176 for(int i=0; i<num; ++i){ 177 SimpleObservable *content = new SimpleObservable(); 178 content->signOn(this); 179 theSet.insert(content); 180 } 181 } 182 183 ~ObservableCollection(){ 184 set::iterator iter; 185 for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){ 186 delete (*iter); 187 } 188 } 189 190 iterator begin(){ 191 return iterator(theSet.begin(),this); 192 } 193 194 iterator end(){ 195 return iterator(theSet.end(),this); 196 } 197 198 const int num; 199 200 private: 201 set theSet; 202 }; 203 164 204 165 205 /******************* actuall tests ***************/ … … 173 213 blockObservable = new BlockObservable(); 174 214 notificationObservable = new NotificationObservable(); 215 collection = new ObservableCollection(5); 175 216 176 217 observer1 = new UpdateCountObserver(); … … 181 222 notificationObserver1 = new NotificationObserver(notificationObservable->notification1); 182 223 notificationObserver2 = new NotificationObserver(notificationObservable->notification2); 183 184 224 } 185 225 … … 191 231 delete blockObservable; 192 232 delete notificationObservable; 233 delete collection; 193 234 194 235 delete observer1; … … 277 318 blockObservable->changeMethod2(); 278 319 blockObservable->noChangeMethod(); 320 } 321 322 void ObserverTest::iteratorTest(){ 323 int i = 0; 324 // test the general iterator methods 325 for(ObservableCollection::iterator iter=collection->begin(); iter!=collection->end();++iter){ 326 CPPUNIT_ASSERT(i< collection->num); 327 i++; 328 } 329 330 i=0; 331 for(ObservableCollection::const_iterator iter=collection->begin(); iter!=collection->end();++iter){ 332 CPPUNIT_ASSERT(i<collection->num); 333 i++; 334 } 335 336 collection->signOn(observer1); 337 { 338 // we construct this out of the loop, so the iterator dies at the end of 339 // the scope and not the end of the loop (allows more testing) 340 ObservableCollection::iterator iter; 341 for(iter=collection->begin(); iter!=collection->end(); ++iter){ 342 (*iter)->changeMethod(); 343 } 344 // At this point no change should have been propagated 345 CPPUNIT_ASSERT_EQUAL( 0, observer1->updates); 346 } 347 // After the Iterator has died the propagation should take place 348 CPPUNIT_ASSERT_EQUAL( 1, observer1->updates); 349 350 // when using a const_iterator no changes should be propagated 351 for(ObservableCollection::const_iterator iter = collection->begin(); iter!=collection->end();++iter); 352 CPPUNIT_ASSERT_EQUAL( 1, observer1->updates); 353 collection->signOff(observer1); 279 354 } 280 355 -
src/unittests/ObserverTest.hpp
r42af9e r1024cb 17 17 class CallObservable; 18 18 class SuperObservable; 19 class ObservableCollection; 19 20 class BlockObservable; 20 21 class NotificationObservable; 21 22 22 23 23 class ObserverTest : public CppUnit::TestFixture … … 29 29 CPPUNIT_TEST ( doesNotifyTest ); 30 30 CPPUNIT_TEST ( doesReportTest ); 31 CPPUNIT_TEST ( iteratorTest ); 31 32 CPPUNIT_TEST ( CircleDetectionTest ); 32 33 CPPUNIT_TEST_SUITE_END(); … … 41 42 void doesNotifyTest(); 42 43 void doesReportTest(); 44 void iteratorTest(); 43 45 void CircleDetectionTest(); 44 46 … … 58 60 SuperObservable *superObservable; 59 61 NotificationObservable *notificationObservable; 62 ObservableCollection *collection; 63 60 64 }; 61 65 -
src/unittests/analysisbondsunittest.cpp
r42af9e r1024cb 25 25 #include "molecule.hpp" 26 26 #include "periodentafel.hpp" 27 #include "World.hpp" 27 28 28 29 #ifdef HAVE_TESTRUNNER … … 76 77 77 78 // check that TestMolecule was correctly constructed 78 CPPUNIT_ASSERT_EQUAL( TestMolecule-> AtomCount, 5 );79 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 5 ); 79 80 80 81 // create a small file with table -
src/unittests/bondgraphunittest.cpp
r42af9e r1024cb 77 77 78 78 // check that TestMolecule was correctly constructed 79 CPPUNIT_ASSERT_EQUAL( TestMolecule-> AtomCount, 4 );79 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 80 80 81 81 // create a small file with table … … 114 114 }; 115 115 116 /** Tests whether setup worked. 117 */ 118 void BondGraphTest::SetupTest() 119 { 120 CPPUNIT_ASSERT_EQUAL (false, TestMolecule->empty()); 121 CPPUNIT_ASSERT_EQUAL ((size_t)4, TestMolecule->size()); 122 }; 123 116 124 /** UnitTest for BondGraphTest::LoadBondLengthTable(). 117 125 */ … … 128 136 void BondGraphTest::ConstructGraphFromTableTest() 129 137 { 130 atom *Walker = TestMolecule->start->next;131 atom *Runner = TestMolecule->end->previous;132 CPPUNIT_ASSERT( TestMolecule->end != Walker );138 molecule::iterator Walker = TestMolecule->begin(); 139 molecule::iterator Runner = TestMolecule->begin(); 140 Runner++; 133 141 CPPUNIT_ASSERT_EQUAL( true , BG->LoadBondLengthTable(*filename) ); 134 142 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 135 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) );143 CPPUNIT_ASSERT_EQUAL( true , (*Walker)->IsBondedTo((*Runner)) ); 136 144 }; 137 145 … … 140 148 void BondGraphTest::ConstructGraphFromCovalentRadiiTest() 141 149 { 142 atom *Walker = TestMolecule->start->next; 143 atom *Runner = TestMolecule->end->previous; 144 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 150 151 //atom *Walker = TestMolecule->start->next; 152 //atom *Runner = TestMolecule->end->previous; 153 //CPPUNIT_ASSERT( TestMolecule->end != Walker ); 145 154 CPPUNIT_ASSERT_EQUAL( false , BG->LoadBondLengthTable(*dummyname) ); 146 155 CPPUNIT_ASSERT_EQUAL( true , BG->ConstructBondGraph(TestMolecule) ); 147 CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) ); 156 157 // this cannot be assured using dynamic IDs 158 //CPPUNIT_ASSERT_EQUAL( true , Walker->IsBondedTo(Runner) ); 148 159 }; 149 160 -
src/unittests/bondgraphunittest.hpp
r42af9e r1024cb 22 22 { 23 23 CPPUNIT_TEST_SUITE( BondGraphTest) ; 24 CPPUNIT_TEST ( SetupTest ); 24 25 CPPUNIT_TEST ( LoadTableTest ); 25 26 CPPUNIT_TEST ( ConstructGraphFromTableTest ); … … 30 31 void setUp(); 31 32 void tearDown(); 33 void SetupTest(); 32 34 void LoadTableTest(); 33 35 void ConstructGraphFromTableTest(); -
src/unittests/listofbondsunittest.cpp
r42af9e r1024cb 67 67 68 68 // check that TestMolecule was correctly constructed 69 CPPUNIT_ASSERT_EQUAL( TestMolecule-> AtomCount, 4 );69 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 4 ); 70 70 }; 71 71 … … 81 81 }; 82 82 83 /** Tests whether setup worked correctly. 84 * 85 */ 86 void ListOfBondsTest::SetupTest() 87 { 88 CPPUNIT_ASSERT_EQUAL( false, TestMolecule->empty() ); 89 CPPUNIT_ASSERT_EQUAL( (size_t)4, TestMolecule->size() ); 90 }; 91 83 92 /** Unit Test of molecule::AddBond() 84 93 * … … 87 96 { 88 97 bond *Binder = NULL; 89 atom *atom1 = TestMolecule->start->next; 90 atom *atom2 = atom1->next; 98 molecule::iterator iter = TestMolecule->begin(); 99 atom *atom1 = *iter; 100 iter++; 101 atom *atom2 = *iter; 91 102 CPPUNIT_ASSERT( atom1 != NULL ); 92 103 CPPUNIT_ASSERT( atom2 != NULL ); … … 115 126 { 116 127 bond *Binder = NULL; 117 atom *atom1 = TestMolecule->start->next; 118 atom *atom2 = atom1->next; 128 molecule::iterator iter = TestMolecule->begin(); 129 atom *atom1 = *iter; 130 iter++; 131 atom *atom2 = *iter; 119 132 CPPUNIT_ASSERT( atom1 != NULL ); 120 133 CPPUNIT_ASSERT( atom2 != NULL ); … … 141 154 { 142 155 bond *Binder = NULL; 143 atom *atom1 = TestMolecule->start->next; 144 atom *atom2 = atom1->next; 145 atom *atom3 = atom2->next; 156 molecule::iterator iter = TestMolecule->begin(); 157 atom *atom1 = *iter; 158 iter++; 159 atom *atom2 = *iter; 160 iter++; 161 atom *atom3 = *iter; 146 162 CPPUNIT_ASSERT( atom1 != NULL ); 147 163 CPPUNIT_ASSERT( atom2 != NULL ); … … 180 196 { 181 197 bond *Binder = NULL; 182 atom *atom1 = TestMolecule->start->next; 183 atom *atom2 = atom1->next; 198 molecule::iterator iter = TestMolecule->begin(); 199 atom *atom1 = *iter; 200 iter++; 201 atom *atom2 = *iter; 184 202 CPPUNIT_ASSERT( atom1 != NULL ); 185 203 CPPUNIT_ASSERT( atom2 != NULL ); … … 206 224 { 207 225 bond *Binder = NULL; 208 atom *atom1 = TestMolecule->start->next; 209 atom *atom2 = atom1->next; 226 molecule::iterator iter = TestMolecule->begin(); 227 atom *atom1 = *iter; 228 iter++; 229 atom *atom2 = *iter; 210 230 CPPUNIT_ASSERT( atom1 != NULL ); 211 231 CPPUNIT_ASSERT( atom2 != NULL ); … … 231 251 { 232 252 bond *Binder = NULL; 233 atom *atom1 = TestMolecule->start->next; 234 atom *atom2 = atom1->next; 253 molecule::iterator iter = TestMolecule->begin(); 254 atom *atom1 = *iter; 255 iter++; 256 atom *atom2 = *iter; 235 257 CPPUNIT_ASSERT( atom1 != NULL ); 236 258 CPPUNIT_ASSERT( atom2 != NULL ); -
src/unittests/listofbondsunittest.hpp
r42af9e r1024cb 20 20 { 21 21 CPPUNIT_TEST_SUITE( ListOfBondsTest) ; 22 CPPUNIT_TEST ( SetupTest ); 22 23 CPPUNIT_TEST ( AddingBondTest ); 23 24 CPPUNIT_TEST ( RemovingBondTest ); … … 31 32 void setUp(); 32 33 void tearDown(); 34 void SetupTest(); 33 35 void AddingBondTest(); 34 36 void RemovingBondTest();
Note:
See TracChangeset
for help on using the changeset viewer.