BOOST_FIXTURE_TEST_CASE(ViscosityValue, TestFixture<SetupSimple>) { const Opm::BlackoilPropsAdFromDeck::Cells cells(5, 0); typedef Opm::BlackoilPropsAdFromDeck::V V; typedef Opm::BlackoilPropsAdFromDeck::ADB ADB; V Vpw; Vpw.resize(cells.size()); Vpw[0] = 1*Opm::unit::barsa; Vpw[1] = 2*Opm::unit::barsa; Vpw[2] = 4*Opm::unit::barsa; Vpw[3] = 8*Opm::unit::barsa; Vpw[4] = 16*Opm::unit::barsa; // standard temperature V T = V::Constant(cells.size(), 273.15+20); BOOST_REQUIRE_EQUAL(Vpw.size(), cells.size()); const V VmuWat = boprops_ad.muWat(ADB::constant(Vpw), ADB::constant(T), cells).value(); BOOST_REQUIRE_EQUAL(Vpw.size(), cells.size()); // Zero pressure dependence in water viscosity for (V::Index i = 0, n = VmuWat.size(); i < n; ++i) { BOOST_CHECK_EQUAL(VmuWat[i], VmuWat[0]); } }
#include "unittest.h" #include "../common/simdarray.h" using namespace Vc; template <typename T, size_t N> constexpr size_t captureN(const SimdArray<T, N> &) { return N; } TEST_TYPES(V, createArray, (SIMD_ARRAY_LIST)) { typedef typename V::VectorEntryType VT; V array; COMPARE(array.size(), captureN(V())); VERIFY(sizeof(array) >= array.size() * sizeof(VT)); VERIFY(sizeof(array) <= 2 * array.size() * sizeof(VT)); } template <typename T, typename U> constexpr T bound(T x, U max) { return x > max ? max : x; } TEST_TYPES(V, checkArrayAlignment, (SIMD_ARRAY_LIST)) { using T = typename V::value_type; using M = typename V::mask_type; COMPARE(alignof(V), bound(sizeof(V), 128u)); // sizeof must be at least as large as alignof to
#include "prio_queue.hpp" #include <queue> #define CATCH_CONFIG_MAIN #include <catch.hpp> using A = rollbear::prio_q_internal::heap_heap_addressing<8>; using V = rollbear::prio_q_internal::skip_vector<int, 4>; using rollbear::prio_queue; TEST_CASE("a default constructed vector is empty", "[vector]") { V v; REQUIRE(v.size() == 0); REQUIRE(v.empty()); } TEST_CASE("a has size 2 after one push_key", "[vector]") { V v; auto i = v.push_back(1); REQUIRE(!v.empty()); REQUIRE(v.size() == 2); REQUIRE(i == 1); } TEST_CASE("a vector of size 2 becomes empty on pop", "[vector]") { V v;