Merge pull request #294 from rolk/294_unittests
Fix non-unit tests so they compile again
This commit is contained in:
commit
92fca433be
@ -137,6 +137,8 @@ list (APPEND MAIN_SOURCE_FILES
|
||||
# find tests -name '*.cpp' -a ! -wholename '*/not-unit/*' -printf '\t%p\n' | sort
|
||||
list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_dgbasis.cpp
|
||||
tests/test_cartgrid.cpp
|
||||
tests/test_cubic.cpp
|
||||
tests/test_nonuniformtablelinear.cpp
|
||||
tests/test_sparsevector.cpp
|
||||
tests/test_sparsetable.cpp
|
||||
@ -150,6 +152,7 @@ list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_param.cpp
|
||||
tests/test_blackoilfluid.cpp
|
||||
tests/test_shadow.cpp
|
||||
tests/test_units.cpp
|
||||
)
|
||||
|
||||
# originally generated with the command:
|
||||
|
1
tests/not-unit/README.txt
Normal file
1
tests/not-unit/README.txt
Normal file
@ -0,0 +1 @@
|
||||
These files are not actively maintained. Do not expect them to compile and run.
|
@ -17,12 +17,11 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridInspector.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridInspector.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
|
||||
|
@ -21,10 +21,9 @@
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridInspector.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridInspector.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
|
||||
|
@ -23,8 +23,8 @@
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include <opm/core/utility/parameters/ParameterGroup.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/eclipse/EclipseGridInspector.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridInspector.hpp>
|
||||
#include <opm/core/props/BlackoilPropertiesFromDeck.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
|
||||
|
@ -108,9 +108,7 @@ int main()
|
||||
|
||||
// Create solver for SPD system.
|
||||
Opm::LinearSolverAGMG linsolve(100, 1e-9, true);
|
||||
|
||||
Opm::LinearSolverInterface::LinearSolverReport
|
||||
rpt = linsolve.solve(A.get(), & b[0], & x[0]);
|
||||
linsolve.solve(A.get(), & b[0], & x[0]);
|
||||
|
||||
double e = 0.0;
|
||||
for (std::size_t i = 0; i < m; ++i) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <suitesparse/umfpack.h>
|
||||
|
||||
#include <opm/core/grid.h>
|
||||
#include <opm/core/well.h>
|
||||
|
||||
#include <opm/core/linalg/sparse_sys.h>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/grid/GridManager.hpp>
|
||||
#include <opm/core/grid/cart_grid.h>
|
||||
#include <opm/core/grid.h>
|
||||
|
@ -79,7 +79,7 @@ main() {
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <opm/core/transport/JacobianSystem.hpp>
|
||||
#include <opm/core/transport/implicit/JacobianSystem.hpp>
|
||||
|
||||
//using namespace Opm::LinAlgSupport;
|
||||
using namespace Opm::ImplicitTransportDefault;
|
||||
@ -104,9 +104,9 @@ main() {
|
||||
#if 1
|
||||
#include <opm/core/linalg/sparse_sys.h>
|
||||
|
||||
#include <opm/core/transport/JacobianSystem.hpp>
|
||||
#include <opm/core/transport/CSRMatrixBlockAssembler.hpp>
|
||||
#include <opm/core/transport/CSRMatrixUmfpackSolver.hpp>
|
||||
#include <opm/core/transport/implicit/JacobianSystem.hpp>
|
||||
#include <opm/core/transport/implicit/CSRMatrixBlockAssembler.hpp>
|
||||
#include <opm/core/transport/implicit/CSRMatrixUmfpackSolver.hpp>
|
||||
|
||||
using namespace Opm::ImplicitTransportDefault;
|
||||
|
||||
|
@ -16,7 +16,7 @@ main(void)
|
||||
struct UnstructuredGrid *G1, *G2;
|
||||
|
||||
G1 = read_grid("cart_grid_2d.txt");
|
||||
G2 = create_grid_cart2d(2, 2);
|
||||
G2 = create_grid_cart2d(2, 2, 1., 1.);
|
||||
|
||||
destroy_grid(G2);
|
||||
destroy_grid(G1);
|
||||
|
@ -36,14 +36,14 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <opm/core/vag_format/vag.hpp>
|
||||
#include <opm/core/io/vag/vag.hpp>
|
||||
#include <opm/core/grid.h>
|
||||
//#include "../config.h"
|
||||
/* test reading of vag grid format */
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
using namespace std;
|
||||
using namespace OPM;
|
||||
using namespace Opm;
|
||||
std::string filename;
|
||||
if (argc == 2) {
|
||||
filename = argv[1];
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <opm/core/eclipse/EclipseGridParser.hpp>
|
||||
#include <opm/core/io/eclipse/EclipseGridParser.hpp>
|
||||
|
||||
// Test program for reading Eclipse Polymer keywords.
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <opm/core/utility/writeVtkData.hpp>
|
||||
#include <opm/core/io/vtk/writeVtkData.hpp>
|
||||
#include <fstream>
|
||||
#include <array>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
Copyright 2012 SINTEF ICT, Applied Mathematics.
|
||||
Portions Copyright 2013 Uni Research AS.
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
@ -17,25 +18,41 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* --- Boost.Test boilerplate --- */
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
|
||||
#define NVERBOSE // Suppress own messages when throw()ing
|
||||
|
||||
#define BOOST_TEST_MODULE CartGridTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
|
||||
/* --- our own headers --- */
|
||||
#include <opm/core/grid/cart_grid.h>
|
||||
#include <opm/core/grid.h>
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
BOOST_AUTO_TEST_SUITE ()
|
||||
|
||||
BOOST_AUTO_TEST_CASE (facenumbers)
|
||||
{
|
||||
using namespace std;
|
||||
struct UnstructuredGrid *g = create_grid_cart2d(2, 2);
|
||||
int faces[] = { 0, 6, 1, 8,
|
||||
1, 7, 2, 9,
|
||||
3, 8, 4, 10,
|
||||
4, 9, 5, 11 };
|
||||
struct UnstructuredGrid *g = create_grid_cart2d(2, 2, 1., 1.);
|
||||
int i;
|
||||
int k;
|
||||
for (i = 0; i < g->number_of_cells; ++i) {
|
||||
fprintf(stderr, "%d: ", i);
|
||||
for (k = g->cell_facepos[i]; k < g->cell_facepos[i + 1]; ++k) {
|
||||
fprintf(stderr, "%d ", g->cell_faces[k]);
|
||||
BOOST_REQUIRE_EQUAL (g->cell_faces[k], faces[k]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
destroy_grid(g);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
@ -16,6 +16,7 @@
|
||||
/*
|
||||
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
|
||||
Copyright 2009, 2010 Statoil ASA.
|
||||
Portions Copyright 2013 Uni Research AS.
|
||||
|
||||
This file is part of The Open Reservoir Simulator Project (OpenRS).
|
||||
|
||||
@ -34,9 +35,25 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <opm/core/utility/MonotCubicInterpolator.hpp>
|
||||
|
||||
int main()
|
||||
/* --- Boost.Test boilerplate --- */
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
|
||||
#define NVERBOSE // Suppress own messages when throw()ing
|
||||
|
||||
#define BOOST_TEST_MODULE CubicTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
|
||||
/* --- our own headers --- */
|
||||
#include <opm/core/utility/MonotCubicInterpolator.hpp>
|
||||
using namespace Opm;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE ()
|
||||
|
||||
BOOST_AUTO_TEST_CASE (cubic)
|
||||
{
|
||||
const int num_v = 3;
|
||||
double xv[num_v] = {0.0, 1.0, 2.0};
|
||||
@ -44,11 +61,13 @@ int main()
|
||||
std::vector<double> x(xv, xv + num_v);
|
||||
std::vector<double> f(fv, fv + num_v);
|
||||
MonotCubicInterpolator interp(x, f);
|
||||
interp.evaluate(-1.0);
|
||||
interp.evaluate(0.0);
|
||||
interp.evaluate(0.0001);
|
||||
interp.evaluate(0.5);
|
||||
interp.evaluate(1.0);
|
||||
interp.evaluate(2.0);
|
||||
interp.evaluate(4.0);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(-1.0), 10., 0.00001);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(0.0), 10., 0.00001);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(0.0001), 10.0011, 0.00001);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(0.5), 17.375, 0.00001);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(1.0), 21., 0.00001);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(2.0), 2., 0.00001);
|
||||
BOOST_REQUIRE_CLOSE (interp.evaluate(4.0), 2., 0.00001);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
@ -34,6 +34,18 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
/* --- Boost.Test boilerplate --- */
|
||||
#if HAVE_DYNAMIC_BOOST_TEST
|
||||
#define BOOST_TEST_DYN_LINK
|
||||
#endif
|
||||
|
||||
#define NVERBOSE // Suppress own messages when throw()ing
|
||||
|
||||
#define BOOST_TEST_MODULE UnitsTest
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/test/floating_point_comparison.hpp>
|
||||
|
||||
/* --- our own headers --- */
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
@ -46,34 +58,31 @@
|
||||
using namespace Opm::prefix;
|
||||
using namespace Opm::unit;
|
||||
|
||||
int main()
|
||||
BOOST_AUTO_TEST_SUITE ()
|
||||
|
||||
BOOST_AUTO_TEST_CASE (units)
|
||||
{
|
||||
std::cout << "m = " << meter << '\n';
|
||||
std::cout << "kg = " << kilogram << '\n';
|
||||
std::cout << "s = " << second << '\n';
|
||||
BOOST_REQUIRE_EQUAL (meter, 1);
|
||||
BOOST_REQUIRE_EQUAL (kilogram, 1);
|
||||
BOOST_REQUIRE_EQUAL (second, 1);
|
||||
|
||||
std::cout << "mD = " << milli*darcy << '\n';
|
||||
std::cout << "MD = " << mega*darcy << '\n';
|
||||
BOOST_REQUIRE_CLOSE (milli*darcy, 9.86923667e-16, 0.01);
|
||||
BOOST_REQUIRE_CLOSE (mega*darcy, 9.86923e-7, 0.01);
|
||||
BOOST_REQUIRE_CLOSE (convert::to(mega*darcy, milli*darcy), 1e9, 0.01);
|
||||
|
||||
std::cout << "MD = " << convert::to(mega*darcy, milli*darcy) << " mD\n";
|
||||
|
||||
std::cout << "1 bar = " << convert::to(convert::from(1.0, barsa), psia) << " psi\n";
|
||||
|
||||
std::cout << "1 atm = " << convert::to(1*atm, barsa) << " bar\n";
|
||||
BOOST_REQUIRE_CLOSE (convert::to(convert::from(1.0, barsa), psia), 14.5038, 0.01);
|
||||
BOOST_REQUIRE_CLOSE (convert::to(1*atm, barsa), 1.01325, 0.01);
|
||||
|
||||
std::vector<double> flux(10, 10000*cubic(meter)/year);
|
||||
|
||||
std::cout << "flux = [";
|
||||
std::copy(flux.begin(), flux.end(),
|
||||
std::ostream_iterator<double>(std::cout, " "));
|
||||
std::cout << "\b] (m^3/s)\n";
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
BOOST_REQUIRE_CLOSE (flux[i], 3.17098e-4, 0.01);
|
||||
}
|
||||
|
||||
std::transform(flux.begin(), flux.end(), flux.begin(),
|
||||
boost::bind(convert::to, _1, cubic(meter)/year));
|
||||
std::cout << " = [";
|
||||
std::copy(flux.begin(), flux.end(),
|
||||
std::ostream_iterator<double>(std::cout, " "));
|
||||
std::cout << "\b] (m^3/year)\n";
|
||||
|
||||
return 0;
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
BOOST_REQUIRE_CLOSE (flux[i], 1e4, 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
Loading…
Reference in New Issue
Block a user