Reimplement ScheduleTests in Terms of TimeStampUTC

Note that we have to reduce the year-range in the specific test

    createDeckWithDRSDTthenDRVDT

in order not to wrap around for system_clock.  This is a deficency of
the new time-service protocol.
This commit is contained in:
Bård Skaflestad 2019-10-15 01:10:46 -05:00
parent 428d4c41f0
commit 7e160cb99a

View File

@ -26,7 +26,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <ert/util/util.hpp>
#include <opm/common/utility/TimeService.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@ -1163,18 +1163,15 @@ BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
BOOST_CHECK_EQUAL(cs4.get( i ).wellPi(), 1.0);
BOOST_CHECK_THROW(schedule.simTime(10000), std::invalid_argument);
auto sim_time1 = schedule.simTime(1);
int day, month,year;
util_set_date_values_utc(sim_time1, &day, &month, &year);
BOOST_CHECK_EQUAL(day, 10);
BOOST_CHECK_EQUAL(month, 10);
BOOST_CHECK_EQUAL(year, 2008);
auto sim_time1 = TimeStampUTC{ schedule.simTime(1) };
BOOST_CHECK_EQUAL(sim_time1.day(), 10);
BOOST_CHECK_EQUAL(sim_time1.month(), 10);
BOOST_CHECK_EQUAL(sim_time1.year(), 2008);
sim_time1 = schedule.simTime(3);
util_set_date_values_utc(sim_time1, &day, &month, &year);
BOOST_CHECK_EQUAL(day, 20);
BOOST_CHECK_EQUAL(month, 1);
BOOST_CHECK_EQUAL(year, 2011);
BOOST_CHECK_EQUAL(sim_time1.day(), 20);
BOOST_CHECK_EQUAL(sim_time1.month(), 1);
BOOST_CHECK_EQUAL(sim_time1.year(), 2011);
}
BOOST_AUTO_TEST_CASE(WELSPECS_WGNAME_SPACE) {
@ -1385,7 +1382,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTthenDRVDT) {
"0.100\n"
"/\n"
"DATES -- 3\n"
" 10 OKT 20010 / \n"
" 10 OKT 2010 / \n"
"/\n"
"VAPPARS\n"
"2 0.100\n"