Changeset 63fb7a for src/Descriptors
- Timestamp:
- Jul 24, 2015, 4:44:34 PM (9 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:
- 1259df
- Parents:
- 795c0f
- git-author:
- Frederik Heber <heber@…> (06/01/15 08:48:35)
- git-committer:
- Frederik Heber <heber@…> (07/24/15 16:44:34)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Descriptors/unittests/MoleculeDescriptorUnitTest.cpp
r795c0f r63fb7a 111 111 void MoleculeDescriptorTest::MoleculeIdTest(){ 112 112 // test Molecules from boundaries and middle of the set 113 molecule* testMolecule; 114 testMolecule = World::getInstance().getMolecule(MoleculeById(moleculeIds[0])); 113 const molecule* testMolecule; 114 testMolecule = const_cast<const World &>(World::getInstance()). 115 getMolecule(MoleculeById(moleculeIds[0])); 115 116 CPPUNIT_ASSERT(testMolecule); 116 117 CPPUNIT_ASSERT_EQUAL( moleculeIds[0], testMolecule->getId()); 117 testMolecule = World::getInstance().getMolecule(MoleculeById(moleculeIds[MOLECULE_COUNT/2])); 118 testMolecule = const_cast<const World &>(World::getInstance()). 119 getMolecule(MoleculeById(moleculeIds[MOLECULE_COUNT/2])); 118 120 CPPUNIT_ASSERT(testMolecule); 119 121 CPPUNIT_ASSERT_EQUAL( moleculeIds[MOLECULE_COUNT/2], testMolecule->getId()); 120 testMolecule = World::getInstance().getMolecule(MoleculeById(moleculeIds[MOLECULE_COUNT-1])); 122 testMolecule = const_cast<const World &>(World::getInstance()). 123 getMolecule(MoleculeById(moleculeIds[MOLECULE_COUNT-1])); 121 124 CPPUNIT_ASSERT(testMolecule); 122 125 CPPUNIT_ASSERT_EQUAL( moleculeIds[MOLECULE_COUNT-1], testMolecule->getId()); … … 132 135 } 133 136 // test from outside of set 134 testMolecule = World::getInstance().getMolecule(MoleculeById(outsideId)); 137 testMolecule = const_cast<const World &>(World::getInstance()). 138 getMolecule(MoleculeById(outsideId)); 135 139 CPPUNIT_ASSERT(!testMolecule); 136 140 } … … 189 193 void MoleculeDescriptorTest::MoleculeNameTest() 190 194 { 191 molecule* testMolecule;195 const molecule* testMolecule; 192 196 193 197 // name each molecule … … 197 201 // retrieve each 198 202 for(int i=1;i<=MOLECULE_COUNT;++i) { 199 testMolecule = World::getInstance().getMolecule(MoleculeByName(toString(i))); 203 testMolecule = const_cast<const World &>(World::getInstance()). 204 getMolecule(MoleculeByName(toString(i))); 200 205 CPPUNIT_ASSERT_EQUAL( moleculeIds[i-1], testMolecule->getId()); 201 206 } 202 207 203 208 // check for non-present name 204 testMolecule = World::getInstance().getMolecule(MoleculeByName("not present")); 209 testMolecule = const_cast<const World &>(World::getInstance()). 210 getMolecule(MoleculeByName("not present")); 205 211 CPPUNIT_ASSERT(!testMolecule); 206 212 } … … 209 215 void MoleculeDescriptorTest::MoleculeOrderTest() 210 216 { 211 molecule* testMolecule;217 const molecule* testMolecule; 212 218 213 219 // test in normal order: 1, 2, ... 214 220 for(int i=1;i<=MOLECULE_COUNT;++i){ 215 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(i)); 221 testMolecule = const_cast<const World &>(World::getInstance()). 222 getMolecule(MoleculeByOrder(i)); 216 223 CPPUNIT_ASSERT_EQUAL( moleculeIds[i-1], testMolecule->getId()); 217 224 } … … 219 226 // test in reverse order: -1, -2, ... 220 227 for(int i=1; i<= MOLECULE_COUNT;++i){ 221 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(-i)); 228 testMolecule = const_cast<const World &>(World::getInstance()). 229 getMolecule(MoleculeByOrder(-i)); 222 230 CPPUNIT_ASSERT_EQUAL( moleculeIds[(int)MOLECULE_COUNT-i], testMolecule->getId()); 223 231 } 224 232 225 233 // test from outside of set 226 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(MOLECULE_COUNT+1)); 227 CPPUNIT_ASSERT(!testMolecule); 228 testMolecule = World::getInstance().getMolecule(MoleculeByOrder(-MOLECULE_COUNT-1)); 229 CPPUNIT_ASSERT(!testMolecule); 230 } 234 testMolecule = const_cast<const World &>(World::getInstance()). 235 getMolecule(MoleculeByOrder(MOLECULE_COUNT+1)); 236 CPPUNIT_ASSERT(!testMolecule); 237 testMolecule = const_cast<const World &>(World::getInstance()). 238 getMolecule(MoleculeByOrder(-MOLECULE_COUNT-1)); 239 CPPUNIT_ASSERT(!testMolecule); 240 }
Note:
See TracChangeset
for help on using the changeset viewer.