Update to new interface of TimeMap
This commit is contained in:
@@ -34,23 +34,23 @@
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateDynamicTest) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
Opm::DynamicState<double> state(timeMap , 9.99);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateGetOutOfRangeThrows) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
Opm::DynamicState<double> state(timeMap , 9.99);
|
||||
BOOST_CHECK_THROW( state.get(1) , std::out_of_range );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateGetDefault) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
BOOST_CHECK_EQUAL( 137 , state.get(0));
|
||||
BOOST_CHECK_EQUAL( 137 , state.back() );
|
||||
@@ -58,10 +58,10 @@ BOOST_AUTO_TEST_CASE(DynamicStateGetDefault) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateSetOutOfRangeThrows) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 2; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
@@ -70,11 +70,11 @@ BOOST_AUTO_TEST_CASE(DynamicStateSetOutOfRangeThrows) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateSetOK) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
state.update(2 , 23 );
|
||||
@@ -99,10 +99,10 @@ BOOST_AUTO_TEST_CASE(DynamicStateSetOK) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateAddAt) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 0);
|
||||
|
||||
@@ -117,10 +117,10 @@ BOOST_AUTO_TEST_CASE(DynamicStateAddAt) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateOperatorSubscript) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
state.update( 10 , 200 );
|
||||
@@ -131,10 +131,10 @@ BOOST_AUTO_TEST_CASE(DynamicStateOperatorSubscript) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicStateInitial) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
Opm::DynamicState<int> state2(timeMap , 137);
|
||||
@@ -167,10 +167,10 @@ BOOST_AUTO_TEST_CASE(DynamicStateInitial) {
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( ResetGlobal ) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
@@ -195,10 +195,10 @@ BOOST_AUTO_TEST_CASE( ResetGlobal ) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( CheckReturn ) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
@@ -209,10 +209,10 @@ BOOST_AUTO_TEST_CASE( CheckReturn ) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( UpdateEmptyInitial ) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 10; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
@@ -223,10 +223,10 @@ BOOST_AUTO_TEST_CASE( UpdateEmptyInitial ) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( find ) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 5; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicState<int> state(timeMap , 137);
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateDynamicTest) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
Opm::DynamicVector<double> vector(timeMap , 9.99);
|
||||
|
||||
BOOST_CHECK_EQUAL( vector[0] , 9.99 );
|
||||
@@ -43,10 +43,10 @@ BOOST_AUTO_TEST_CASE(CreateDynamicTest) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicVectorSet) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicVector<int> state(timeMap , 137);
|
||||
BOOST_CHECK_EQUAL( 137 , state[0] );
|
||||
@@ -68,10 +68,10 @@ BOOST_AUTO_TEST_CASE(DynamicVectorSet) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DynamicVectorPtr) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::DynamicVector<int> state( timeMap , 137 );
|
||||
BOOST_CHECK_EQUAL( 137 , state.iget(0) );
|
||||
|
||||
@@ -29,12 +29,12 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateEmpty) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{boost::posix_time::ptime(startDate)};
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
Opm::DynamicVector<double> vector(timeMap , 9.99);
|
||||
|
||||
for (size_t i = 0; i < 11; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
|
||||
Opm::Events events( timeMap );
|
||||
|
||||
@@ -64,8 +64,8 @@ BOOST_AUTO_TEST_CASE(CreateEmpty) {
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestMultiple) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{boost::posix_time::ptime(startDate)};
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
Opm::DynamicVector<double> vector(timeMap , 9.99);
|
||||
Opm::Events events( timeMap );
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
using namespace Opm;
|
||||
|
||||
static TimeMap createXDaysTimeMap(size_t numDays) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < numDays; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
return timeMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
using namespace Opm;
|
||||
|
||||
static Opm::TimeMap createXDaysTimeMap(size_t numDays) {
|
||||
boost::gregorian::date startDate( 2010 , boost::gregorian::Jan , 1);
|
||||
Opm::TimeMap timeMap{ boost::posix_time::ptime(startDate ) };
|
||||
const std::time_t startDate = Opm::TimeMap::mkdate(2010, 1, 1);
|
||||
Opm::TimeMap timeMap{ startDate };
|
||||
for (size_t i = 0; i < numDays; i++)
|
||||
timeMap.addTStep( boost::posix_time::hours( (i+1) * 24 ));
|
||||
timeMap.addTStep((i+1) * 24 * 60 * 60);
|
||||
return timeMap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user