Changeset 3c5ef5 for src/Parameters/unittests
- Timestamp:
- May 31, 2012, 1:25:16 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:
- 0b84b9
- Parents:
- 9b5eb0
- git-author:
- Michael Ankele <ankele@…> (04/16/12 12:56:12)
- git-committer:
- Michael Ankele <ankele@…> (05/31/12 13:25:16)
- Location:
- src/Parameters/unittests
- Files:
-
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parameters/unittests/ContinuousParameterTest.cpp
r9b5eb0 r3c5ef5 26 26 #include "Parameters/Parameter.hpp" 27 27 28 #include " ../Range.hpp"28 #include "CodePatterns/Range.hpp" 29 29 30 30 #ifdef HAVE_TESTRUNNER -
src/Parameters/unittests/ContinuousValueTest.cpp
r9b5eb0 r3c5ef5 24 24 #include <cppunit/ui/text/TestRunner.h> 25 25 26 #include "Parameters/ ContinuousValue.hpp"26 #include "Parameters/Value.hpp" 27 27 28 28 #ifdef HAVE_TESTRUNNER … … 57 57 { 58 58 // create instance 59 ContinuousValue<int> test(*ValidIntRange);59 Value<int> test(*ValidIntRange); 60 60 61 61 // checking valid values … … 76 76 { 77 77 // create instance 78 ContinuousValue<int> test(*ValidIntRange);78 Value<int> test(*ValidIntRange); 79 79 80 80 // checking valid values … … 96 96 { 97 97 // create instance 98 ContinuousValue<int> test(*ValidIntRange);98 Value<int> test(*ValidIntRange); 99 99 100 100 // extending range and checking … … 108 108 { 109 109 // create instance 110 ContinuousValue<int> test(*ValidIntRange);110 Value<int> test(*ValidIntRange); 111 111 112 112 // lowering range with set value … … 135 135 { 136 136 // create instance 137 ContinuousValue<int> test(*ValidIntRange);137 Value<int> test(*ValidIntRange); 138 138 139 139 // unset calling of get, throws … … 168 168 { 169 169 // create instance 170 ContinuousValue<int> test(*ValidIntRange);170 Value<int> test(*ValidIntRange); 171 171 172 172 // unset calling of get, throws … … 200 200 { 201 201 // create instance 202 ContinuousValue<int> test(*ValidIntRange);203 ContinuousValue<int> instance(*ValidIntRange);202 Value<int> test(*ValidIntRange); 203 Value<int> instance(*ValidIntRange); 204 204 test.set(1); 205 205 instance.set(1); … … 219 219 } 220 220 { 221 ContinuousValue<int> test(*ValidIntRange);221 Value<int> test(*ValidIntRange); 222 222 range<int> OtherValidIntRange(1,5); 223 ContinuousValue<int> instance(OtherValidIntRange);223 Value<int> instance(OtherValidIntRange); 224 224 225 225 test.set(1); … … 282 282 { 283 283 // create instance 284 ContinuousValue<Vector> test(*ValidVectorRange);284 Value<Vector> test(*ValidVectorRange); 285 285 286 286 // checking valid values … … 314 314 { 315 315 // create instance 316 ContinuousValue<Vector> test(*ValidVectorRange);316 Value<Vector> test(*ValidVectorRange); 317 317 318 318 // extending range and checking … … 326 326 { 327 327 // create instance 328 ContinuousValue<Vector> test(*ValidVectorRange);328 Value<Vector> test(*ValidVectorRange); 329 329 330 330 // lowering range with set value … … 353 353 { 354 354 // create instance 355 /* ContinuousValue<Vector> test(*ValidVectorRange);355 /*Value<Vector> test(*ValidVectorRange); 356 356 357 357 // unset calling of get, throws … … 387 387 { 388 388 // create instance 389 ContinuousValue<Vector> test(*ValidVectorRange);389 Value<Vector> test(*ValidVectorRange); 390 390 391 391 // unset calling of get, throws … … 422 422 { 423 423 // create instance 424 ContinuousValue<Vector> test(*ValidVectorRange);425 ContinuousValue<Vector> instance(*ValidVectorRange);424 Value<Vector> test(*ValidVectorRange); 425 Value<Vector> instance(*ValidVectorRange); 426 426 test.set(Vector(5,6,7)); 427 427 instance.set(Vector(5,6,7)); … … 441 441 } 442 442 { 443 ContinuousValue<Vector> test(*ValidVectorRange);443 Value<Vector> test(*ValidVectorRange); 444 444 range<Vector> OtherValidVectorRange(Vector(0,1,2), Vector(20,21,22)); 445 ContinuousValue<Vector> instance(OtherValidVectorRange);445 Value<Vector> instance(OtherValidVectorRange); 446 446 447 447 test.set(Vector(1,2,3)); -
src/Parameters/unittests/DiscreteValueTest.cpp
r9b5eb0 r3c5ef5 24 24 #include <cppunit/ui/text/TestRunner.h> 25 25 26 #include "Parameters/ DiscreteValue.hpp"26 #include "Parameters/Value.hpp" 27 27 28 28 #ifdef HAVE_TESTRUNNER … … 59 59 { 60 60 // create instance 61 DiscreteValue<int> test(ValidValues);61 Value<int> test(ValidValues); 62 62 63 63 // check valid values indices 64 CPPUNIT_ASSERT_EQUAL((size_t)0, test.findIndexOfValue(1));65 CPPUNIT_ASSERT_EQUAL((size_t)1, test.findIndexOfValue(2));66 CPPUNIT_ASSERT_EQUAL((size_t)2, test.findIndexOfValue(3));64 CPPUNIT_ASSERT_EQUAL((size_t)0, dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).findIndexOfValue(1)); 65 CPPUNIT_ASSERT_EQUAL((size_t)1, dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).findIndexOfValue(2)); 66 CPPUNIT_ASSERT_EQUAL((size_t)2, dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).findIndexOfValue(3)); 67 67 68 68 // check invalid ones 69 69 for (int i=-10; i<=0;++i) 70 CPPUNIT_ASSERT_EQUAL((size_t)-1, test.findIndexOfValue(i));70 CPPUNIT_ASSERT_EQUAL((size_t)-1, dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).findIndexOfValue(i)); 71 71 for (int i=4; i<=0;++i) 72 CPPUNIT_ASSERT_EQUAL((size_t)-1, test.findIndexOfValue(i));72 CPPUNIT_ASSERT_EQUAL((size_t)-1, dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).findIndexOfValue(i)); 73 73 } 74 74 … … 79 79 { 80 80 // create instance 81 DiscreteValue<int> test(ValidValues);81 Value<int> test(ValidValues); 82 82 83 83 // checking valid values … … 98 98 { 99 99 // create instance 100 DiscreteValue<int> test(ValidValues);100 Value<int> test(ValidValues); 101 101 102 102 // checking valid values … … 117 117 { 118 118 // create instance 119 DiscreteValue<int> test(ValidValues);119 Value<int> test(ValidValues); 120 120 121 121 // adding values 4,5,6 122 122 for (int i=4; i<=6;++i) { 123 123 CPPUNIT_ASSERT_EQUAL(false, test.isValid(i)); 124 test.appendValidValue(i);124 dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).appendValidValue(i); 125 125 CPPUNIT_ASSERT_EQUAL(true, test.isValid(i)); 126 126 } 127 127 128 128 // adding same value, throws assertion 129 const size_t size_before = test.ValidValues.size();129 const size_t size_before = dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).getValidValues().size(); 130 130 #ifndef NDEBUG 131 131 std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl; 132 132 for (int i=1; i<=6;++i) 133 CPPUNIT_ASSERT_THROW( test.appendValidValue(i), Assert::AssertionFailure);134 #endif 135 CPPUNIT_ASSERT_EQUAL( size_before, test.ValidValues.size() );133 CPPUNIT_ASSERT_THROW(dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).appendValidValue(i), Assert::AssertionFailure); 134 #endif 135 CPPUNIT_ASSERT_EQUAL( size_before, dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).getValidValues().size() ); 136 136 137 137 // checking valid values … … 154 154 { 155 155 // create instance 156 DiscreteValue<int> test(ValidValues);156 Value<int> test(ValidValues); 157 157 158 158 // unset calling of get, throws … … 186 186 { 187 187 // create instance 188 DiscreteValue<int> test(ValidValues);188 Value<int> test(ValidValues); 189 189 190 190 // unset calling of get, throws … … 218 218 { 219 219 // create instance 220 DiscreteValue<int> test(ValidValues);221 DiscreteValue<int> instance(ValidValues);220 Value<int> test(ValidValues); 221 Value<int> instance(ValidValues); 222 222 test.set(1); 223 223 instance.set(1); … … 237 237 } 238 238 { 239 DiscreteValue<int> test(ValidValues);240 DiscreteValue<int> instance(ValidValues);241 instance.appendValidValue(4);239 Value<int> test(ValidValues); 240 Value<int> instance(ValidValues); 241 dynamic_cast<DiscreteValidator<int> &>(instance.getValidator()).appendValidValue(4); 242 242 243 243 test.set(1); -
src/Parameters/unittests/Makefile.am
r9b5eb0 r3c5ef5 7 7 ../Parameters/unittests/ContinuousParameterTest.cpp \ 8 8 ../Parameters/unittests/DiscreteValueTest.cpp \ 9 ../Parameters/unittests/DiscreteParameterTest.cpp \ 10 ../Parameters/unittests/ValueTest.cpp 9 ../Parameters/unittests/DiscreteParameterTest.cpp 11 10 12 11 PARAMETERSTESTSHEADERS = \ … … 14 13 ../Parameters/unittests/ContinuousParameterTest.hpp \ 15 14 ../Parameters/unittests/DiscreteValueTest.hpp \ 16 ../Parameters/unittests/DiscreteParameterTest.hpp \ 17 ../Parameters/unittests/ValueTest.hpp 15 ../Parameters/unittests/DiscreteParameterTest.hpp 18 16 19 17 PARAMETERSTESTS = \ … … 21 19 ContinuousParameterTest \ 22 20 DiscreteValueTest \ 23 DiscreteParameterTest \ 24 ValueTest 21 DiscreteParameterTest 25 22 26 23 TESTS += $(PARAMETERSTESTS) … … 34 31 ../Parameters/unittests/ContinuousValueTest.cpp \ 35 32 ../Parameters/unittests/ContinuousValueTest.hpp \ 33 ../Parameters/Validators/DiscreteValidator.hpp \ 34 ../Parameters/Validators/DiscreteValidator_impl.hpp \ 36 35 ../Parameters/Validators/DummyValidator.hpp \ 37 36 ../Parameters/Validators/RangeValidator.hpp \ 37 ../Parameters/Validators/RangeValidator_impl.hpp \ 38 38 ../Parameters/Validators/Validator.hpp \ 39 ../Parameters/Validators/VectorRangeValidator.hpp \ 40 ../Parameters/ContinuousValue.hpp \ 41 ../Parameters/ContinuousValue_impl.hpp \ 42 ../Parameters/Range.hpp \ 43 ../Parameters/ValueInterface.hpp 39 ../Parameters/Value.hpp \ 40 ../Parameters/Value_impl.hpp \ 41 ../Parameters/ValueInterface.hpp \ 42 ../Parameters/VectorFromString.hpp 44 43 ContinuousValueTest_LDADD = \ 45 44 $(PARAMETERSLIBS) \ … … 49 48 ../Parameters/unittests/ContinuousParameterTest.cpp \ 50 49 ../Parameters/unittests/ContinuousParameterTest.hpp \ 51 ../Parameters/Validators/DummyValidator.hpp \52 ../Parameters/Validators/RangeValidator.hpp \53 ../Parameters/Validators/Validator.hpp \54 ../Parameters/Validators/VectorRangeValidator.hpp \55 50 ../Parameters/ContinuousValue.hpp \ 56 51 ../Parameters/ContinuousValue_impl.hpp \ 57 52 ../Parameters/ContinuousParameter.hpp \ 58 53 ../Parameters/ContinuousParameter_impl.hpp \ 54 ../Parameters/Parameter.hpp \ 55 ../Parameters/Parameter_impl.hpp \ 59 56 ../Parameters/ParameterInterface.hpp \ 60 ../Parameters/Range.hpp \ 57 ../Parameters/Validators/DiscreteValidator.hpp \ 58 ../Parameters/Validators/DiscreteValidator_impl.hpp \ 59 ../Parameters/Validators/DummyValidator.hpp \ 60 ../Parameters/Validators/RangeValidator.hpp \ 61 ../Parameters/Validators/RangeValidator_impl.hpp \ 62 ../Parameters/Validators/Validator.hpp \ 63 ../Parameters/Value.hpp \ 64 ../Parameters/Value_impl.hpp \ 61 65 ../Parameters/ValueInterface.hpp 62 66 ContinuousParameterTest_LDADD = \ … … 70 74 ../Parameters/Validators/DiscreteValidator_impl.hpp \ 71 75 ../Parameters/Validators/DummyValidator.hpp \ 76 ../Parameters/Validators/RangeValidator.hpp \ 77 ../Parameters/Validators/RangeValidator_impl.hpp \ 72 78 ../Parameters/Validators/Validator.hpp \ 73 ../Parameters/ DiscreteValue.hpp \74 ../Parameters/ DiscreteValue_impl.hpp \79 ../Parameters/Value.hpp \ 80 ../Parameters/Value_impl.hpp \ 75 81 ../Parameters/ValueInterface.hpp 76 82 DiscreteValueTest_LDADD = \ 77 $(PARAMETERSLIBS) 83 $(PARAMETERSLIBS) \ 84 $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la 78 85 79 86 DiscreteParameterTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 80 87 ../Parameters/unittests/DiscreteParameterTest.cpp \ 81 88 ../Parameters/unittests/DiscreteParameterTest.hpp \ 82 ../Parameters/Validators/DiscreteValidator.hpp \83 ../Parameters/Validators/DiscreteValidator_impl.hpp \84 ../Parameters/Validators/DummyValidator.hpp \85 ../Parameters/Validators/Validator.hpp \86 89 ../Parameters/DiscreteValue.hpp \ 87 90 ../Parameters/DiscreteValue_impl.hpp \ 88 91 ../Parameters/DiscreteParameter.hpp \ 89 92 ../Parameters/DiscreteParameter_impl.hpp \ 93 ../Parameters/Parameter.hpp \ 94 ../Parameters/Parameter_impl.hpp \ 90 95 ../Parameters/ParameterInterface.hpp \ 91 ../Parameters/ValueInterface.hpp 92 DiscreteParameterTest_LDADD = \ 93 $(PARAMETERSLIBS) 94 95 96 ValueTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \ 97 ../Parameters/unittests/ValueTest.cpp \ 98 ../Parameters/unittests/ValueTest.hpp \ 96 ../Parameters/Validators/DiscreteValidator.hpp \ 97 ../Parameters/Validators/DiscreteValidator_impl.hpp \ 98 ../Parameters/Validators/DummyValidator.hpp \ 99 ../Parameters/Validators/RangeValidator.hpp \ 100 ../Parameters/Validators/RangeValidator_impl.hpp \ 101 ../Parameters/Validators/Validator.hpp \ 99 102 ../Parameters/Value.hpp \ 100 103 ../Parameters/Value_impl.hpp \ 101 104 ../Parameters/ValueInterface.hpp 102 ContinuousValueTest_LDADD = \105 DiscreteParameterTest_LDADD = \ 103 106 $(PARAMETERSLIBS) \ 104 107 $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la
Note:
See TracChangeset
for help on using the changeset viewer.