Changeset a7b761b for src/unittests/LinkedCellUnitTest.cpp
- Timestamp:
- May 27, 2010, 10:46:54 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, Candidate_v1.7.0, 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:
- 1024cb
- Parents:
- 8f215d (diff), 05a97c (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. - File:
-
- 1 edited
-
src/unittests/LinkedCellUnitTest.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/unittests/LinkedCellUnitTest.cpp
r8f215d ra7b761b 69 69 70 70 // check that TestMolecule was correctly constructed 71 CPPUNIT_ASSERT_EQUAL( TestMolecule->AtomCount, 3*3*3 ); 72 Walker = TestMolecule->start->next; 73 CPPUNIT_ASSERT( TestMolecule->end != Walker ); 71 CPPUNIT_ASSERT_EQUAL( TestMolecule->getAtomCount(), 3*3*3 ); 74 72 }; 75 73 … … 197 195 { 198 196 // check all atoms 199 atom *Walker = TestMolecule->start; 200 while (Walker->next != TestMolecule->end) { 201 Walker = Walker->next; 202 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(Walker) ); 197 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end();++iter){ 198 CPPUNIT_ASSERT_EQUAL( true, LC->SetIndexToNode(*iter) ); 203 199 } 204 200 205 201 // check internal vectors, returns false, because this atom is not in LC-list! 206 Walker= World::getInstance().createAtom();207 Walker->setName("test");208 Walker->x= Vector(1,1,1);209 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode( Walker) );210 World::getInstance().destroyAtom( Walker);202 atom *newAtom = World::getInstance().createAtom(); 203 newAtom->setName("test"); 204 newAtom->x= Vector(1,1,1); 205 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); 206 World::getInstance().destroyAtom(newAtom); 211 207 212 208 // check out of bounds vectors 213 Walker= World::getInstance().createAtom();214 Walker->setName("test");215 Walker->x = Vector(0,-1,0);216 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode( Walker) );217 World::getInstance().destroyAtom( Walker);209 newAtom = World::getInstance().createAtom(); 210 newAtom->setName("test"); 211 newAtom->x = Vector(0,-1,0); 212 CPPUNIT_ASSERT_EQUAL( false, LC->SetIndexToNode(newAtom) ); 213 World::getInstance().destroyAtom(newAtom); 218 214 }; 219 215 … … 287 283 size = ListOfPoints->size(); 288 284 CPPUNIT_ASSERT_EQUAL( (size_t)27, size ); 289 Walker = TestMolecule->start; 290 Walker = TestMolecule->start; 291 while (Walker->next != TestMolecule->end) { 292 Walker = Walker->next; 293 ListOfPoints->remove(Walker); 285 286 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ 287 ListOfPoints->remove((*iter)); 294 288 size--; 295 289 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); … … 306 300 size=ListOfPoints->size(); 307 301 CPPUNIT_ASSERT_EQUAL( (size_t)8, size ); 308 Walker = TestMolecule->start; 309 while (Walker->next != TestMolecule->end) { 310 Walker = Walker->next; 311 if ((Walker->x[0] <2) && (Walker->x[1] <2) && (Walker->x[2] <2)) { 312 ListOfPoints->remove(Walker); 302 for(molecule::iterator iter = TestMolecule->begin(); iter != TestMolecule->end(); ++iter){ 303 if (((*iter)->x[0] <2) && ((*iter)->x[1] <2) && ((*iter)->x[2] <2)) { 304 ListOfPoints->remove(*iter); 313 305 size--; 314 306 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); … … 326 318 size=ListOfPoints->size(); 327 319 CPPUNIT_ASSERT_EQUAL( (size_t)27, size ); 328 Walker = TestMolecule->start; 329 while (Walker->next != TestMolecule->end) { 330 Walker = Walker->next; 331 ListOfPoints->remove(Walker); 320 for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ 321 ListOfPoints->remove(*iter); 332 322 size--; 333 323 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() ); … … 355 345 size = ListOfPoints->size(); 356 346 CPPUNIT_ASSERT_EQUAL( (size_t)7, size ); 357 Walker = TestMolecule->start; 358 while (Walker->next != TestMolecule->end) { 359 Walker = Walker->next; 360 if ((Walker->x.DistanceSquared(tester) - 1.) < MYEPSILON ) { 361 ListOfPoints->remove(Walker); 347 for(molecule::iterator iter = TestMolecule->begin(); iter!=TestMolecule->end();++iter){ 348 if (((*iter)->x.DistanceSquared(tester) - 1.) < MYEPSILON ) { 349 ListOfPoints->remove(*iter); 362 350 size--; 363 351 CPPUNIT_ASSERT_EQUAL( size, ListOfPoints->size() );
Note:
See TracChangeset
for help on using the changeset viewer.
