Changeset 3e6b93


Ignore:
Timestamp:
Feb 4, 2015, 9:56:43 PM (11 years ago)
Author:
Frederik Heber <heber@…>
Parents:
76a109
git-author:
Frederik Heber <heber@…> (09/23/14 16:34:50)
git-committer:
Frederik Heber <heber@…> (02/04/15 21:56:43)
Message:

Changed checking of Parameter::isValid() on set(), not on get().

  • this would fix problems with ActionQueue::OutputAs...() commands that need to get() parameter values after usage by the Action. If files were forced to be non-present before, then written by the Action, the Validator will then fail.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/Parameters/Value_impl.hpp

    r76a109 r3e6b93  
    119119inline const T & Value<T>::get() const throw(ParameterValueException)
    120120{
    121   if (!isValid(value)) throw ParameterValueException();
     121  // Actions' parameters may later become invalid because a file has been
     122  // written that was supposed to not exist (!FilePresentValidator())
     123  //  if (!isValid(value)) throw ParameterValueException();
    122124  if (!ValueSet) throw ParameterValueException();
    123125  return value;
     
    131133inline void Value<T>::set(const T & _value) throw(ParameterException)
    132134{
    133   // any value may be set, this allows Actions to have invalid parameters
    134   // (e.g. because the given atom id does not yet exist) that are checked
    135   // on performCall()
    136 //  if (!isValid(_value)) throw ParameterValueException();
     135  if (!isValid(_value)) throw ParameterValueException();
    137136  if (!ValueSet)
    138137    ValueSet = true;
  • src/Parameters/unittests/ContinuousValueTest.cpp

    r76a109 r3e6b93  
    155155  {
    156156    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);
     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(5)), ParameterValueException);
     159    std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;
     160    CPPUNIT_ASSERT_THROW(test.setAsString(toString(0)), ParameterValueException);
    162161  }
    163162
     
    187186
    188187  // 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);
     188  std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;
     189  CPPUNIT_ASSERT_THROW(test.set(5), ParameterValueException);
     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.set(0), ParameterValueException);
    195192
    196193  // checking all valid ones
     
    400397  {
    401398    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);
     399    std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;
     400    CPPUNIT_ASSERT_THROW(test.set(Vector(5,0,0)), ParameterValueException);
     401    std::cout << "The following Assert failures are intended and do not indicate a failure of the test." << std::endl;
     402    CPPUNIT_ASSERT_THROW(test.set(Vector(5,20,5)), ParameterValueException);
    408403  }
    409404
  • src/Parameters/unittests/DiscreteValueTest.cpp

    r76a109 r3e6b93  
    175175
    176176  // 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);
     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);
    183181
    184182  // checking all valid ones
     
    203201
    204202  // 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);
     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);
    211207
    212208  // checking all valid ones
  • tests/regression/Parser/SetParameters/Mpqc/testsuite-parser-set-parameters-mpqc-none.at

    r76a109 r3e6b93  
    2121AT_KEYWORDS([options mpqc set-mpqc-parameters])
    2222
    23 AT_CHECK([../../molecuilder -i test.in -o mpqc -l ${abs_top_srcdir}/tests/regression/Parser/SetParameters/Mpqc/pre/test.xyz -v 1 --set-parser-parameters "mpqc"], 5, [stdout], [ignore])
     23AT_CHECK([../../molecuilder \
     24        -i test.in \
     25        -o mpqc \
     26        -l ${abs_top_srcdir}/tests/regression/Parser/SetParameters/Mpqc/pre/test.xyz \
     27        -v 1 \
     28        --set-parser-parameters "mpqc" \
     29                --parser-parameters ""], 134, [stdout], [ignore])
    2430
    2531AT_CLEANUP
Note: See TracChangeset for help on using the changeset viewer.