Verified behaviour of defaults (i.e. *) for multivalued items.
This commit is contained in:
@@ -63,8 +63,8 @@ ENDSCALE\n\
|
||||
1* 1* 2 /\n\
|
||||
\n\
|
||||
ENKRVD\n\
|
||||
100 * 2 * 2* 6 7 200 11 22 33 3*55 10 /\n\
|
||||
100 * 2 3 4 5 6 7 200 11 22 33 44 55 66 77 /\n\
|
||||
100 1 2 3 4 5 6 7 200 11 22 33 44 55 66 77 /\n\
|
||||
";
|
||||
|
||||
|
||||
@@ -80,8 +80,22 @@ BOOST_AUTO_TEST_CASE( parse_DATAWithDefult_OK ) {
|
||||
DeckItemConstPtr item1 = rec1->getItem(0);
|
||||
|
||||
BOOST_CHECK_EQUAL( 2U , keyword->size());
|
||||
|
||||
BOOST_CHECK_THROW( item0->defaultApplied() , std::invalid_argument);
|
||||
|
||||
BOOST_CHECK_EQUAL( 100 , item0->getRawDouble(0));
|
||||
BOOST_CHECK_EQUAL( -1 , item0->getRawDouble(1));
|
||||
BOOST_CHECK_EQUAL( 2 , item0->getRawDouble(2));
|
||||
BOOST_CHECK_EQUAL( -1 , item0->getRawDouble(3));
|
||||
BOOST_CHECK_EQUAL( -1 , item0->getRawDouble(4));
|
||||
BOOST_CHECK_EQUAL( -1 , item0->getRawDouble(5));
|
||||
BOOST_CHECK_EQUAL( 6 , item0->getRawDouble(6));
|
||||
BOOST_CHECK_EQUAL( 55 , item0->getRawDouble(12));
|
||||
BOOST_CHECK_EQUAL( 55 , item0->getRawDouble(13));
|
||||
BOOST_CHECK_EQUAL( 55 , item0->getRawDouble(14));
|
||||
BOOST_CHECK_EQUAL( 10 , item0->getRawDouble(15));
|
||||
|
||||
BOOST_CHECK_EQUAL( 100 , item1->getRawDouble(0));
|
||||
BOOST_CHECK_EQUAL( -1 , item1->getRawDouble(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -131,13 +131,12 @@ namespace Opm
|
||||
DeckDoubleItemPtr deckItem(new DeckDoubleItem(name() , scalar()));
|
||||
double defaultValue = m_default;
|
||||
|
||||
if (sizeType() == ALL) { // This can probably not be combined with a default value ....
|
||||
// The '*' should be interpreted as a multiplication sign
|
||||
if (sizeType() == ALL) {
|
||||
while (rawRecord->size() > 0) {
|
||||
std::string token = rawRecord->pop_front();
|
||||
if (tokenContainsStar( token )) {
|
||||
StarToken<double> st(token);
|
||||
double value = defaultValue; // This probably does never apply
|
||||
double value = defaultValue;
|
||||
if (st.hasValue())
|
||||
value = st.value();
|
||||
deckItem->push_backMultiple( value , st.multiplier() );
|
||||
|
||||
@@ -131,13 +131,12 @@ namespace Opm
|
||||
DeckFloatItemPtr deckItem(new DeckFloatItem(name() , scalar()));
|
||||
float defaultValue = m_default;
|
||||
|
||||
if (sizeType() == ALL) { // This can probably not be combined with a default value ....
|
||||
// The '*' should be interpreted as a multiplication sign
|
||||
if (sizeType() == ALL) {
|
||||
while (rawRecord->size() > 0) {
|
||||
std::string token = rawRecord->pop_front();
|
||||
if (tokenContainsStar( token )) {
|
||||
StarToken<float> st(token);
|
||||
float value = defaultValue; // This probably does never apply
|
||||
float value = defaultValue;
|
||||
if (st.hasValue())
|
||||
value = st.value();
|
||||
deckItem->push_backMultiple( value , st.multiplier() );
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace Opm {
|
||||
int defaultValue = m_default;
|
||||
|
||||
if (sizeType() == ALL) {
|
||||
// This can probably not be combined with a default value ....
|
||||
// The '*' should be interpreted as a multiplication sign
|
||||
// The '*' should be interpreted either as a default indicator in the cases '*' and '5*'
|
||||
// or as multiplier in the case: '5*99'.
|
||||
while (rawRecord->size() > 0) {
|
||||
std::string token = rawRecord->pop_front();
|
||||
if (tokenContainsStar( token )) {
|
||||
StarToken<int> st(token);
|
||||
int value = defaultValue; // This probably does never apply
|
||||
int value = defaultValue;
|
||||
if (st.hasValue())
|
||||
value = st.value();
|
||||
deckItem->push_backMultiple( value , st.multiplier() );
|
||||
|
||||
@@ -67,13 +67,12 @@ namespace Opm {
|
||||
DeckStringItemPtr deckItem(new DeckStringItem(name() , scalar()));
|
||||
std::string defaultValue = m_default;
|
||||
|
||||
if (sizeType() == ALL) { // This can probably not be combined with a default value ....
|
||||
// The '*' should be interpreted as a multiplication sign
|
||||
if (sizeType() == ALL) {
|
||||
while (rawRecord->size() > 0) {
|
||||
std::string token = rawRecord->pop_front();
|
||||
if (tokenContainsStar( token )) {
|
||||
StarToken<std::string> st(token);
|
||||
std::string value = defaultValue; // This probably does never apply
|
||||
std::string value = defaultValue;
|
||||
if (st.hasValue())
|
||||
value = st.value();
|
||||
deckItem->push_backMultiple( value , st.multiplier() );
|
||||
|
||||
Reference in New Issue
Block a user