Fix UDQParsing code to handle numerical values on scientific form

This commit is contained in:
Joakim Hove
2020-06-30 11:18:18 +02:00
parent c663805694
commit fc4511d365
2 changed files with 31 additions and 1 deletions

View File

@@ -92,7 +92,6 @@ BOOST_AUTO_TEST_CASE(SUBTRACT)
BOOST_CHECK_EQUAL( res2[0].value(), 16.0);
}
BOOST_AUTO_TEST_CASE(TEST)
{
UDQParams udqp;
@@ -1620,3 +1619,23 @@ WCONPROD
}
}
BOOST_AUTO_TEST_CASE(UDQ_SCIENTIFIC_LITERAL) {
std::string deck_string = R"(
SCHEDULE
UDQ
DEFINE FU 0 -1.25E-2*(1.0E-1 + 2E-1) /
/
)";
auto schedule = make_schedule(deck_string);
const auto& udq = schedule.getUDQConfig(0);
UDQParams udqp;
auto def0 = udq.definitions()[0];
SummaryState st(std::chrono::system_clock::now());
UDQFunctionTable udqft(udqp);
UDQContext context(udqft, st);
auto res0 = def0.eval(context);
BOOST_CHECK_CLOSE( res0[0].value(), -0.00125*3, 1e-6);
}