Changeset 0d4168 for src/Parameters/unittests
- Timestamp:
- May 20, 2014, 8:47:03 AM (11 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:
- cc6e5c
- Parents:
- c09f94
- git-author:
- Frederik Heber <heber@…> (08/28/13 23:05:38)
- git-committer:
- Frederik Heber <heber@…> (05/20/14 08:47:03)
- Location:
- src/Parameters/unittests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parameters/unittests/ContinuousValueTest.cpp
rc09f94 r0d4168 145 145 void ContinuousValueTest::settergetterIntAsStringTest() 146 146 { 147 // unset calling of get, throws ParameterValueException 148 { 149 Value<int> test(*ValidIntRange); 150 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 151 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 152 } 153 154 // setting invalid and getting it, throws ParameterValueException 155 { 156 Value<int> test(*ValidIntRange); 157 test.setAsString(toString(5)); 158 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 159 test.setAsString(toString(0)); 160 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 161 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 162 } 163 164 // checking all valid ones 165 { 166 Value<int> test(*ValidIntRange); 167 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet); 168 for (int i=1; i<=4;++i) { 169 test.setAsString(toString(i)); 170 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet); 171 CPPUNIT_ASSERT_EQUAL(toString(i), test.getAsString()); 172 } 173 } 174 } 175 176 /** Unit test for setters and getters. 177 * 178 */ 179 void ContinuousValueTest::settergetterIntTest() 180 { 147 181 // create instance 148 182 Value<int> test(*ValidIntRange); … … 150 184 // unset calling of get, throws ParameterValueException 151 185 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 152 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException);153 154 // setting invalid, throws ParameterValueException155 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;156 CPPUNIT_ASSERT_THROW(test.setAsString(toString(5)), ParameterValueException);157 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;158 CPPUNIT_ASSERT_THROW(test.setAsString(toString(0)), ParameterValueException);159 160 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet);161 // checking all valid ones162 for (int i=1; i<=4;++i) {163 test.setAsString(toString(i));164 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet);165 CPPUNIT_ASSERT_EQUAL(toString(i), test.getAsString());166 }167 }168 169 /** Unit test for setters and getters.170 *171 */172 void ContinuousValueTest::settergetterIntTest()173 {174 // create instance175 Value<int> test(*ValidIntRange);176 177 // unset calling of get, throws ParameterValueException178 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;179 186 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 180 187 181 // setting invalid, throws ParameterValueException 182 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 183 CPPUNIT_ASSERT_THROW(test.set(5), ParameterValueException); 184 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 185 CPPUNIT_ASSERT_THROW(test.set(0), ParameterValueException); 188 // setting invalid and getting it, throws ParameterValueException 189 test.set(5); 190 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 191 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 192 test.set(0); 193 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 194 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 186 195 187 196 // checking all valid ones … … 381 390 void ContinuousValueTest::settergetterVectorTest() 382 391 { 383 // create instance384 Value<Vector> test(*ValidVectorRange);385 386 392 // unset calling of get, throws 387 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 388 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 389 390 // setting invalid, throws 391 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 392 CPPUNIT_ASSERT_THROW(test.set(Vector(5,0,0)), ParameterValueException); 393 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 394 CPPUNIT_ASSERT_THROW(test.set(Vector(5,20,5)), ParameterValueException); 395 396 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet); 393 { 394 Value<Vector> test(*ValidVectorRange); 395 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 396 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 397 } 398 399 // setting invalid and getting it, throws 400 { 401 Value<Vector> test(*ValidVectorRange); 402 test.set(Vector(5,0,0)); 403 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 404 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 405 test.set(Vector(5,20,5)); 406 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 407 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 408 } 409 397 410 // checking some valid ones 398 for (int i=1; i<=4;++i) { 399 Vector v(i,5,5); 400 test.set(v); 401 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet); 402 CPPUNIT_ASSERT_EQUAL(v, test.get()); 411 { 412 Value<Vector> test(*ValidVectorRange); 413 CPPUNIT_ASSERT_EQUAL(false, test.ValueSet); 414 for (int i=1; i<=4;++i) { 415 Vector v(i,5,5); 416 test.set(v); 417 CPPUNIT_ASSERT_EQUAL(true, test.ValueSet); 418 CPPUNIT_ASSERT_EQUAL(v, test.get()); 419 } 403 420 } 404 421 } -
src/Parameters/unittests/DiscreteValueTest.cpp
rc09f94 r0d4168 174 174 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 175 175 176 // setting invalid, throws 177 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 178 CPPUNIT_ASSERT_THROW(test.set(4), ParameterValueException); 179 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 180 CPPUNIT_ASSERT_THROW(test.set(0), ParameterValueException); 176 // setting invalid and getting it, throws 177 test.set(4); 178 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 179 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 180 test.set(0); 181 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 182 CPPUNIT_ASSERT_THROW(test.get(), ParameterValueException); 181 183 182 184 // checking all valid ones … … 200 202 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 201 203 202 // setting invalid, throws 203 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 204 CPPUNIT_ASSERT_THROW(test.setAsString(toString(4)), ParameterValueException); 205 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 206 CPPUNIT_ASSERT_THROW(test.setAsString(toString(0)), ParameterValueException); 204 // setting invalid and getting it, throws 205 test.setAsString(toString(4)); 206 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 207 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 208 test.setAsString(toString(0)); 209 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 210 CPPUNIT_ASSERT_THROW(test.getAsString(), ParameterValueException); 207 211 208 212 // checking all valid ones
Note:
See TracChangeset
for help on using the changeset viewer.