Ignore:
Timestamp:
May 31, 2012, 1:25:16 PM (13 years ago)
Author:
Michael Ankele <ankele@…>
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)
Message:

DiscreteValueTest uses new Value class

Location:
src/Parameters/unittests
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parameters/unittests/ContinuousParameterTest.cpp

    r9b5eb0 r3c5ef5  
    2626#include "Parameters/Parameter.hpp"
    2727
    28 #include "../Range.hpp"
     28#include "CodePatterns/Range.hpp"
    2929
    3030#ifdef HAVE_TESTRUNNER
  • src/Parameters/unittests/ContinuousValueTest.cpp

    r9b5eb0 r3c5ef5  
    2424#include <cppunit/ui/text/TestRunner.h>
    2525
    26 #include "Parameters/ContinuousValue.hpp"
     26#include "Parameters/Value.hpp"
    2727
    2828#ifdef HAVE_TESTRUNNER
     
    5757{
    5858  // create instance
    59   ContinuousValue<int> test(*ValidIntRange);
     59  Value<int> test(*ValidIntRange);
    6060
    6161  // checking valid values
     
    7676{
    7777  // create instance
    78   ContinuousValue<int> test(*ValidIntRange);
     78  Value<int> test(*ValidIntRange);
    7979
    8080  // checking valid values
     
    9696  {
    9797    // create instance
    98     ContinuousValue<int> test(*ValidIntRange);
     98    Value<int> test(*ValidIntRange);
    9999
    100100    // extending range and checking
     
    108108  {
    109109    // create instance
    110     ContinuousValue<int> test(*ValidIntRange);
     110    Value<int> test(*ValidIntRange);
    111111
    112112    // lowering range with set value
     
    135135{
    136136  // create instance
    137   ContinuousValue<int> test(*ValidIntRange);
     137  Value<int> test(*ValidIntRange);
    138138
    139139  // unset calling of get, throws
     
    168168{
    169169  // create instance
    170   ContinuousValue<int> test(*ValidIntRange);
     170  Value<int> test(*ValidIntRange);
    171171
    172172  // unset calling of get, throws
     
    200200  {
    201201    // create instance
    202     ContinuousValue<int> test(*ValidIntRange);
    203     ContinuousValue<int> instance(*ValidIntRange);
     202    Value<int> test(*ValidIntRange);
     203    Value<int> instance(*ValidIntRange);
    204204    test.set(1);
    205205    instance.set(1);
     
    219219  }
    220220  {
    221     ContinuousValue<int> test(*ValidIntRange);
     221    Value<int> test(*ValidIntRange);
    222222    range<int> OtherValidIntRange(1,5);
    223     ContinuousValue<int> instance(OtherValidIntRange);
     223    Value<int> instance(OtherValidIntRange);
    224224
    225225    test.set(1);
     
    282282{
    283283  // create instance
    284   ContinuousValue<Vector> test(*ValidVectorRange);
     284  Value<Vector> test(*ValidVectorRange);
    285285
    286286  // checking valid values
     
    314314  {
    315315    // create instance
    316     ContinuousValue<Vector> test(*ValidVectorRange);
     316    Value<Vector> test(*ValidVectorRange);
    317317
    318318    // extending range and checking
     
    326326  {
    327327    // create instance
    328     ContinuousValue<Vector> test(*ValidVectorRange);
     328    Value<Vector> test(*ValidVectorRange);
    329329
    330330    // lowering range with set value
     
    353353{
    354354  // create instance
    355   /*ContinuousValue<Vector> test(*ValidVectorRange);
     355  /*Value<Vector> test(*ValidVectorRange);
    356356
    357357  // unset calling of get, throws
     
    387387{
    388388  // create instance
    389   ContinuousValue<Vector> test(*ValidVectorRange);
     389  Value<Vector> test(*ValidVectorRange);
    390390
    391391  // unset calling of get, throws
     
    422422  {
    423423    // create instance
    424     ContinuousValue<Vector> test(*ValidVectorRange);
    425     ContinuousValue<Vector> instance(*ValidVectorRange);
     424    Value<Vector> test(*ValidVectorRange);
     425    Value<Vector> instance(*ValidVectorRange);
    426426    test.set(Vector(5,6,7));
    427427    instance.set(Vector(5,6,7));
     
    441441  }
    442442  {
    443     ContinuousValue<Vector> test(*ValidVectorRange);
     443    Value<Vector> test(*ValidVectorRange);
    444444    range<Vector> OtherValidVectorRange(Vector(0,1,2), Vector(20,21,22));
    445     ContinuousValue<Vector> instance(OtherValidVectorRange);
     445    Value<Vector> instance(OtherValidVectorRange);
    446446
    447447    test.set(Vector(1,2,3));
  • src/Parameters/unittests/DiscreteValueTest.cpp

    r9b5eb0 r3c5ef5  
    2424#include <cppunit/ui/text/TestRunner.h>
    2525
    26 #include "Parameters/DiscreteValue.hpp"
     26#include "Parameters/Value.hpp"
    2727
    2828#ifdef HAVE_TESTRUNNER
     
    5959{
    6060  // create instance
    61   DiscreteValue<int> test(ValidValues);
     61  Value<int> test(ValidValues);
    6262
    6363  // 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));
    6767
    6868  // check invalid ones
    6969  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));
    7171  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));
    7373}
    7474
     
    7979{
    8080  // create instance
    81   DiscreteValue<int> test(ValidValues);
     81  Value<int> test(ValidValues);
    8282
    8383  // checking valid values
     
    9898{
    9999  // create instance
    100   DiscreteValue<int> test(ValidValues);
     100  Value<int> test(ValidValues);
    101101
    102102  // checking valid values
     
    117117{
    118118  // create instance
    119   DiscreteValue<int> test(ValidValues);
     119  Value<int> test(ValidValues);
    120120
    121121  // adding values 4,5,6
    122122  for (int i=4; i<=6;++i) {
    123123    CPPUNIT_ASSERT_EQUAL(false, test.isValid(i));
    124     test.appendValidValue(i);
     124    dynamic_cast<DiscreteValidator<int> &>(test.getValidator()).appendValidValue(i);
    125125    CPPUNIT_ASSERT_EQUAL(true, test.isValid(i));
    126126  }
    127127
    128128  // 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();
    130130#ifndef NDEBUG
    131131  std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;
    132132  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() );
    136136
    137137  // checking valid values
     
    154154{
    155155  // create instance
    156   DiscreteValue<int> test(ValidValues);
     156  Value<int> test(ValidValues);
    157157
    158158  // unset calling of get, throws
     
    186186{
    187187  // create instance
    188   DiscreteValue<int> test(ValidValues);
     188  Value<int> test(ValidValues);
    189189
    190190  // unset calling of get, throws
     
    218218  {
    219219    // create instance
    220     DiscreteValue<int> test(ValidValues);
    221     DiscreteValue<int> instance(ValidValues);
     220    Value<int> test(ValidValues);
     221    Value<int> instance(ValidValues);
    222222    test.set(1);
    223223    instance.set(1);
     
    237237  }
    238238  {
    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);
    242242
    243243    test.set(1);
  • src/Parameters/unittests/Makefile.am

    r9b5eb0 r3c5ef5  
    77        ../Parameters/unittests/ContinuousParameterTest.cpp \
    88        ../Parameters/unittests/DiscreteValueTest.cpp \
    9         ../Parameters/unittests/DiscreteParameterTest.cpp \
    10         ../Parameters/unittests/ValueTest.cpp
     9        ../Parameters/unittests/DiscreteParameterTest.cpp
    1110
    1211PARAMETERSTESTSHEADERS = \
     
    1413        ../Parameters/unittests/ContinuousParameterTest.hpp \
    1514        ../Parameters/unittests/DiscreteValueTest.hpp \
    16         ../Parameters/unittests/DiscreteParameterTest.hpp \
    17         ../Parameters/unittests/ValueTest.hpp
     15        ../Parameters/unittests/DiscreteParameterTest.hpp
    1816
    1917PARAMETERSTESTS = \
     
    2119        ContinuousParameterTest \
    2220        DiscreteValueTest \
    23         DiscreteParameterTest \
    24         ValueTest
     21        DiscreteParameterTest
    2522
    2623TESTS += $(PARAMETERSTESTS)
     
    3431        ../Parameters/unittests/ContinuousValueTest.cpp \
    3532        ../Parameters/unittests/ContinuousValueTest.hpp \
     33        ../Parameters/Validators/DiscreteValidator.hpp \
     34        ../Parameters/Validators/DiscreteValidator_impl.hpp \
    3635        ../Parameters/Validators/DummyValidator.hpp \
    3736        ../Parameters/Validators/RangeValidator.hpp \
     37        ../Parameters/Validators/RangeValidator_impl.hpp \
    3838        ../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
    4443ContinuousValueTest_LDADD = \
    4544        $(PARAMETERSLIBS) \
     
    4948        ../Parameters/unittests/ContinuousParameterTest.cpp \
    5049        ../Parameters/unittests/ContinuousParameterTest.hpp \
    51         ../Parameters/Validators/DummyValidator.hpp \
    52         ../Parameters/Validators/RangeValidator.hpp \
    53         ../Parameters/Validators/Validator.hpp \
    54         ../Parameters/Validators/VectorRangeValidator.hpp \
    5550        ../Parameters/ContinuousValue.hpp \
    5651        ../Parameters/ContinuousValue_impl.hpp \
    5752        ../Parameters/ContinuousParameter.hpp \
    5853        ../Parameters/ContinuousParameter_impl.hpp \
     54        ../Parameters/Parameter.hpp \
     55        ../Parameters/Parameter_impl.hpp \
    5956        ../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 \
    6165        ../Parameters/ValueInterface.hpp
    6266ContinuousParameterTest_LDADD = \
     
    7074        ../Parameters/Validators/DiscreteValidator_impl.hpp \
    7175        ../Parameters/Validators/DummyValidator.hpp \
     76        ../Parameters/Validators/RangeValidator.hpp \
     77        ../Parameters/Validators/RangeValidator_impl.hpp \
    7278        ../Parameters/Validators/Validator.hpp \
    73         ../Parameters/DiscreteValue.hpp \
    74         ../Parameters/DiscreteValue_impl.hpp \
     79        ../Parameters/Value.hpp \
     80        ../Parameters/Value_impl.hpp \
    7581        ../Parameters/ValueInterface.hpp
    7682DiscreteValueTest_LDADD = \
    77         $(PARAMETERSLIBS)
     83        $(PARAMETERSLIBS) \
     84        $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la
    7885
    7986DiscreteParameterTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
    8087        ../Parameters/unittests/DiscreteParameterTest.cpp \
    8188        ../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 \
    8689        ../Parameters/DiscreteValue.hpp \
    8790        ../Parameters/DiscreteValue_impl.hpp \
    8891        ../Parameters/DiscreteParameter.hpp \
    8992        ../Parameters/DiscreteParameter_impl.hpp \
     93        ../Parameters/Parameter.hpp \
     94        ../Parameters/Parameter_impl.hpp \
    9095        ../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 \
    99102        ../Parameters/Value.hpp \
    100103        ../Parameters/Value_impl.hpp \
    101104        ../Parameters/ValueInterface.hpp
    102 ContinuousValueTest_LDADD = \
     105DiscreteParameterTest_LDADD = \
    103106        $(PARAMETERSLIBS) \
    104107        $(top_builddir)/LinearAlgebra/src/LinearAlgebra/libLinearAlgebra.la
Note: See TracChangeset for help on using the changeset viewer.