Changed to two applications for comparison

- restartRegressionTest, initRegressionTest was squashed to one
 application, which also supports integration test as well as test
 of restart files (non-unified) and .RFT files.

- summaryRegressionTest was renamed compareSummary -- now it can
 execute an integration test as well as regression test. Also other
 improvements were made.
This commit is contained in:
Arne Morten Kvarving
2016-09-19 14:36:03 +02:00
parent 3bb1cda00c
commit a403a8d21c
7 changed files with 545 additions and 436 deletions

View File

@@ -1,24 +1,25 @@
/*
Copyright 2016 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
+ Copyright 2016 Statoil ASA.
+
+ This file is part of the Open Porous Media project (OPM).
+
+ OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OPM is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OPM. If not, see <http://www.gnu.org/licenses/>.
+ */
#include "config.h"
#include <opm/test_util/summaryComparator.hpp>
#include <opm/test_util/summaryIntegrationTest.hpp>
#if HAVE_DYNAMIC_BOOST_TEST
@@ -40,35 +41,59 @@ BOOST_AUTO_TEST_CASE(deviation){
}
BOOST_AUTO_TEST_CASE(median){
std::vector<double> vec = {8.6, 0.6 ,0 , 3.0, 7.2};
BOOST_CHECK_EQUAL(3,SummaryComparator::median(vec));
vec.pop_back();
BOOST_CHECK_EQUAL(1.8, SummaryComparator::median(vec));
BOOST_AUTO_TEST_CASE(area) {
double width1 = 0;
double width2 = 2;
double width3 = 10;
}
double area1 = IntegrationTest::getRectangleArea(1,width2);
double area2 = IntegrationTest::getRectangleArea(10,width1);
double area3 = IntegrationTest::getRectangleArea(4,width3);
BOOST_AUTO_TEST_CASE(interpolation){
double timeArray[3] = {6,1,2};
double linearCheckValues[2] = {6,11};
double linearCheckValues_2[2] = {2,12};
double constCheckValues[2] = {3,3};
double linearLP = SummaryComparator::interpolation(linearCheckValues[1],linearCheckValues[0], timeArray);
double constLP = SummaryComparator::interpolation(constCheckValues[1], constCheckValues[0], timeArray);
double linearLP_2 = SummaryComparator::interpolation(linearCheckValues_2[1], linearCheckValues_2[0], timeArray);
BOOST_CHECK_EQUAL(linearLP,7);
BOOST_CHECK_EQUAL(constLP,3);
BOOST_CHECK_EQUAL(linearLP_2,4);
BOOST_CHECK_EQUAL(area1,2);
BOOST_CHECK_EQUAL(area2,0);
BOOST_CHECK_EQUAL(area3,40);
}
BOOST_AUTO_TEST_CASE(average) {
BOOST_AUTO_TEST_CASE(operatorOverload) {
WellProductionVolume volumeA;
WellProductionVolume volumeB;
volumeA.total = 2;
volumeA.error = 2;
volumeB.total = 3;
volumeB.error = 1;
volumeA += volumeB;
std::vector<double> vec = {1,2,3,4,5,6};
const double tol = 1.0e-14;
double avg = SummaryComparator::average(vec);
BOOST_CHECK_CLOSE(avg, 21.0/6, tol);
BOOST_CHECK_EQUAL(volumeA.total,5);
BOOST_CHECK_EQUAL(volumeA.error,3);
}
BOOST_AUTO_TEST_CASE(integration) {
std::vector<double> data1 = {2,2,2,2,2,2};
std::vector<double> time1 = {0,1,2,3,4,5};
double val1 = IntegrationTest::integrate(time1, data1);
std::vector<double> data2 = {3, 3, 4, 3, 2, 1, 0, 4};
std::vector<double> time2 = {0, 0.5, 1, 2, 3, 3.5, 4.5, 5};
std::vector<double> data3 = {0, 0, 0, 0, 0, 0, 0, 0};
std::vector<double> data4 = {0, 1, 4, 1, 2, 4, 0, 2, 5, 6, 3};
std::vector<double> time4 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10};
std::vector<double> data5 = {0, 4, 3, 2, 5, 6, 3, 1, 0, 4, 2, 1};
std::vector<double> time5 = {0, 0.5, 1, 2.5, 3, 4, 4.5, 6, 7.5,8, 9.5 ,10};
double val2 = IntegrationTest::integrateError(time1, data1, time2, data2);
double val3 = IntegrationTest::integrateError(time1, data1, time2, data3);
double val4 = IntegrationTest::integrateError(time1, data1, time1, data1);
double val5 = IntegrationTest::integrateError(time4, data4, time5, data5);
BOOST_CHECK_EQUAL(val1,10);
BOOST_CHECK_EQUAL(val2,6);
BOOST_CHECK_EQUAL(val3,10);
BOOST_CHECK_EQUAL(val4,0);
BOOST_CHECK_EQUAL(val5,24.5);
}