#include <catch.hpp>
#include <boost/log/trivial.hpp>
#include "../core_mesh.cpp"
Go to the source code of this file.
|
| | TEST_CASE ("UNIT TEST: sign function {sgn<T>}","[core]") |
| |
| | TEST_CASE ("UNIT TEST: periodicity functions {get_per}","[core_mesh]") |
| |
| | TEST_CASE ("UNIT TEST: assign functions iterator {IT}","[core_mesh]") |
| |
| #define BOOST_LOG_DYN_LINK 1 |
| TEST_CASE |
( |
"UNIT TEST: sign function {sgn<T>}" |
, |
|
|
"" |
[core] |
|
) |
| |
Definition at line 8 of file test_core_mesh.cpp.
References CHECK, and sgn().
8 : sign
function {sgn<T>}
", "[core]
" ) 10 BOOST_LOG_TRIVIAL(info) << "sign
function {sgn<T>}
"; 13 CHECK( sgn(10) == 1 ); 14 CHECK( sgn(-5) == -1 ); 15 CHECK( sgn(0.) == 0 ); 16 CHECK( sgn(0.34534f) == 1 ); 17 CHECK( sgn(-1.34534E16) == -1 );
| TEST_CASE |
( |
"UNIT TEST: periodicity functions {get_per}" |
, |
|
|
"" |
[core_mesh] |
|
) |
| |
Definition at line 20 of file test_core_mesh.cpp.
References CHECK, and get_per().
20 : periodicity functions {
get_per}
", "[core_mesh]
" ) 22 BOOST_LOG_TRIVIAL(info) << "periodicity functions {
get_per}
"; 24 CHECK( get_per(9.4, 10) == Approx(9.4) ); 25 CHECK( get_per(31.4, 10) == Approx(1.4) ); 26 CHECK( get_per(-7.4, 10) == Approx(2.6) ); 27 CHECK( get_per(10.0, 10) == Approx(0.0) ); 28 CHECK( get_per(0.0, 10) == Approx(0.0) ); 29 CHECK( get_per(-0.0, 10) == Approx(0.0) ); 30 CHECK( get_per(-10.0, 10) == Approx(0.0) ); 32 CHECK( get_per(9, 10) == 9 ); 33 CHECK( get_per(31, 10) == 1 ); 34 CHECK( get_per(-7, 10) == 3 ); 35 CHECK( get_per(10, 10) == 0 ); 36 CHECK( get_per(0, 10) == 0 ); 37 CHECK( get_per(-0, 10) == 0 ); 38 CHECK( get_per(-10, 10) == 0 ); 40 Vec_3D<double> pos(0., -10., 10.); 42 Vec_3D<double> pos2(4.3, -7.8, 18.4); 45 CHECK( pos[0] == Approx(0.) ); 46 CHECK( pos[1] == Approx(0.) ); 47 CHECK( pos[2] == Approx(0.) ); 48 CHECK( pos2[0] == Approx(4.3) ); 49 CHECK( pos2[1] == Approx(2.2) ); 50 CHECK( pos2[2] == Approx(8.4) ); 52 Vec_3D<int> posi(0, -10, 10); 54 Vec_3D<int> pos2i(4, -7, 18); 57 CHECK( posi == Vec_3D<int>(0, 0, 0) ); 58 CHECK( pos2i == Vec_3D<int>(4, 3, 8) ); 60 Vec_3D<int> pos4i(0, -10, 10); 61 get_per(pos4i, 5, 10, 4); 62 CHECK( pos4i == Vec_3D<int>(0, 0, 2) ); static std::enable_if< std::is_integral< T >::value, T >::type get_per(T vec, size_t per)
| TEST_CASE |
( |
"UNIT TEST: assign functions iterator {IT}" |
, |
|
|
"" |
[core_mesh] |
|
) |
| |
Definition at line 65 of file test_core_mesh.cpp.
References CHECK, CHECK_FALSE, IT< points >::counter, IT< points >::iter(), REQUIRE, and IT< points >::vec.
65 : assign functions iterator {
IT}
", "[core_mesh]
" ) 67 BOOST_LOG_TRIVIAL(info) << "assign functions iterator {
IT}
"; 69 IT<1> it1(Vec_3D<FTYPE_t>(3.2, 7.8, 4.0)); 70 REQUIRE( it1.vec == Vec_3D<size_t>(3, 8, 4) ); 71 CHECK( it1.counter == 0); 72 CHECK_FALSE( it1.iter() ); 74 IT<2> it2(Vec_3D<FTYPE_t>(3.2, 7.8, 4.0)); 75 REQUIRE( it2.vec == Vec_3D<size_t>(3, 7, 4) ); 78 IT<3> it3(Vec_3D<FTYPE_t>(3.2, 7.8, 4.0), 2); 79 REQUIRE( it3.vec == Vec_3D<size_t>(0, 2, 1) ); 81 CHECK( it2.vec == Vec_3D<size_t>(3, 7, 5) ); 83 CHECK( it2.vec == Vec_3D<size_t>(3, 8, 4) ); 85 do{} while( it2.iter() ); 86 CHECK( it2.vec == Vec_3D<size_t>(4, 8, 5) ); 87 }: class for effective iteration of cube of mesh cells