DeckValue: removed reset method.
This commit is contained in:
@@ -38,11 +38,6 @@ class DeckValue {
|
||||
template<typename T>
|
||||
bool is() const;
|
||||
|
||||
void reset(int value);
|
||||
void reset(double value);
|
||||
void reset(const std::string& value);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
bool is_numeric() const;
|
||||
|
||||
@@ -89,23 +89,5 @@ bool DeckValue::is_numeric() const {
|
||||
return (is_int or is_double);
|
||||
}
|
||||
|
||||
void DeckValue::reset(int value) {
|
||||
this->is_int = true;
|
||||
this->is_double = false;
|
||||
this->int_value = value;
|
||||
}
|
||||
|
||||
void DeckValue::reset(double value) {
|
||||
this->is_int = false;
|
||||
this->is_double = true;
|
||||
this->double_value = value;
|
||||
}
|
||||
|
||||
void DeckValue::reset(const std::string& value) {
|
||||
this->is_int = false;
|
||||
this->is_double = false;
|
||||
this->string_value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -21,21 +21,8 @@ BOOST_AUTO_TEST_CASE(DeckValueTest) {
|
||||
BOOST_CHECK(!value0.is<std::string>());
|
||||
BOOST_CHECK_EQUAL( value0.get<int>(), 0);
|
||||
BOOST_CHECK_THROW( value0.get<std::string>(), std::invalid_argument);
|
||||
value0.reset( 10 );
|
||||
BOOST_CHECK_EQUAL( value0.get<int>(), 10);
|
||||
BOOST_CHECK_THROW( value0.get<std::string>(), std::invalid_argument);
|
||||
BOOST_CHECK_THROW( value0.get<double>(), std::invalid_argument);
|
||||
|
||||
value0.reset( "STRING" );
|
||||
BOOST_CHECK_EQUAL( value0.get<std::string>(), std::string("STRING"));
|
||||
BOOST_CHECK_THROW( value0.get<int>(), std::invalid_argument);
|
||||
BOOST_CHECK_THROW( value0.get<double>(), std::invalid_argument);
|
||||
|
||||
value0.reset( 2.5 );
|
||||
BOOST_CHECK_EQUAL( value0.get<double>(), 2.5);
|
||||
BOOST_CHECK_THROW( value0.get<std::string>(), std::invalid_argument);
|
||||
BOOST_CHECK_THROW( value0.get<int>(), std::invalid_argument);
|
||||
|
||||
DeckValue value1(10);
|
||||
BOOST_CHECK(value1.is<int>());
|
||||
BOOST_CHECK(!value1.is<std::string>());
|
||||
|
||||
Reference in New Issue
Block a user