Changeset 12c4cb
- Timestamp:
- Mar 27, 2012, 3:53:36 PM (13 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:
- 64b197
- Parents:
- 4824045
- git-author:
- Frederik Heber <heber@…> (03/22/12 17:37:28)
- git-committer:
- Frederik Heber <heber@…> (03/27/12 15:53:36)
- Location:
- src/Descriptors
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Descriptors/MoleculeOrderDescriptor.cpp
r4824045 r12c4cb 61 61 for (; res != molecules.end_internal(); ++res) { // when iterator is normal, ++ goes forward! 62 62 ++i; 63 if (id == i) 63 if (id == i) { 64 mol = res->second; 64 65 break; 66 } 65 67 } 66 mol = res->second;67 68 } else { 68 69 World::MoleculeSet::reverse_internal_iterator res = molecules.rbegin_internal(); 69 for (; res != molecules.rend_internal(); --res) { // when iterator is reverse, ++ goes backward!70 for (; res != molecules.rend_internal(); ++res) { // when iterator is reverse, ++ goes backward! 70 71 --i; 71 if (id == i) 72 if (id == i) { 73 mol = res->second; 72 74 break; 75 } 73 76 } 74 mol = res->second;75 77 } 76 78 -
src/Descriptors/unittests/MoleculeDescriptorUnitTest.cpp
r4824045 r12c4cb 25 25 #include <Descriptors/MoleculeDescriptor.hpp> 26 26 #include <Descriptors/MoleculeIdDescriptor.hpp> 27 #include <Descriptors/MoleculeNameDescriptor.hpp> 28 #include <Descriptors/MoleculeOrderDescriptor.hpp> 27 29 28 30 #include "World.hpp" … … 169 171 } 170 172 } 173 174 void MoleculeDescriptorTest::MoleculeNameTest() 175 { 176 molecule* testMolecule; 177 178 // name each molecule 179 for(int i=1;i<=MOLECULE_COUNT;++i) 180 molecules[i-1]->setName(toString(i)); 181 182 // retrieve each 183 for(int i=1;i<=MOLECULE_COUNT;++i) { 184 testMolecule = World::getInstance().getMolecule(MoleculeByName(toString(i))); 185 CPPUNIT_ASSERT_EQUAL( moleculeIds[i-1], testMolecule->getId()); 186 } 187 188 // check for non-present name 189 testMolecule = World::getInstance().getMolecule(MoleculeByName("not present")); 190 CPPUNIT_ASSERT(!testMolecule); 191 } 192 193 194 void MoleculeDescriptorTest::MoleculeOrderTest() 195 { 196 molecule* testMolecule; 197 198 // test in normal order: 1, 2, ... 199 for(int i=1;i<=MOLECULE_COUNT;++i){ 200 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(i)); 201 CPPUNIT_ASSERT_EQUAL( moleculeIds[i-1], testMolecule->getId()); 202 } 203 204 // test in reverse order: -1, -2, ... 205 for(int i=1; i<= MOLECULE_COUNT;++i){ 206 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(-i)); 207 CPPUNIT_ASSERT_EQUAL( moleculeIds[(int)MOLECULE_COUNT-i], testMolecule->getId()); 208 } 209 210 // test from outside of set 211 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(MOLECULE_COUNT+1)); 212 CPPUNIT_ASSERT(!testMolecule); 213 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(-MOLECULE_COUNT-1)); 214 CPPUNIT_ASSERT(!testMolecule); 215 } -
src/Descriptors/unittests/MoleculeDescriptorUnitTest.hpp
r4824045 r12c4cb 30 30 CPPUNIT_TEST ( MoleculeIdTest ); 31 31 CPPUNIT_TEST ( MoleculeCalcTest ); 32 CPPUNIT_TEST ( MoleculeOrderTest ); 33 CPPUNIT_TEST ( MoleculeNameTest ); 32 34 CPPUNIT_TEST_SUITE_END(); 33 35 … … 39 41 void MoleculeIdTest(); 40 42 void MoleculeCalcTest(); 43 void MoleculeOrderTest(); 44 void MoleculeNameTest(); 41 45 42 46 private:
Note:
See TracChangeset
for help on using the changeset viewer.