Skip to content

Commit

Permalink
Impliziter Namensraum für Dimensionen in Testhilfsmakros
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfehrs committed Aug 8, 2024
1 parent e3b3507 commit f351dc8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
20 changes: 10 additions & 10 deletions tests/include/zollstock/tests/constant_test_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
#include <catch2/catch_test_macros.hpp>


#define TEST_BASE_UNIT_CONSTANT(symbol_, dimension_, factor_) \
{ \
using namespace zollstock; \
\
static constexpr auto factor = std::get<0>(symbol_.factors); \
\
STATIC_REQUIRE(factor.dimension == dimension_); \
STATIC_REQUIRE(factor.symbol == #symbol_ ); \
STATIC_REQUIRE(factor.scaling_factor == factor_ ); \
#define TEST_BASE_UNIT_CONSTANT(symbol_, dimension_, factor_) \
{ \
using namespace zollstock; \
\
static constexpr auto factor = std::get<0>(symbol_.factors); \
\
STATIC_REQUIRE(factor.dimension == dimensions::dimension_); \
STATIC_REQUIRE(factor.symbol == #symbol_ ); \
STATIC_REQUIRE(factor.scaling_factor == factor_ ); \
}

#define TEST_PREFIXED_BASE_SI_UNIT_CONSTANT(symbol_, dimension_, prefix) \
Expand All @@ -24,7 +24,7 @@
\
static constexpr auto factor = std::get<0>(prefix##symbol_.factors); \
\
STATIC_REQUIRE(factor.dimension == dimension_); \
STATIC_REQUIRE(factor.dimension == dimensions::dimension_); \
STATIC_REQUIRE(factor.symbol == si_prefixes::prefix.symbol + #symbol_); \
STATIC_REQUIRE(factor.scaling_factor == si_prefixes::prefix.factor); \
}
Expand Down
11 changes: 5 additions & 6 deletions tests/sources/angle_unit_constant_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
#include <catch2/catch_all.hpp>


namespace dim = zollstock::dimensions;
using namespace zollstock::units;


TEST_CASE("angle-unit-constants", "[angle][unit][constants]")
{
TEST_BASE_UNIT_CONSTANTS(ALL, rad , dim::_1)
TEST_BASE_UNIT_CONSTANTS(ALL, gon , dim::_1)
TEST_BASE_UNIT_CONSTANTS(ALL, asec, dim::_1)
TEST_BASE_UNIT_CONSTANTS(ALL, rad , _1)
TEST_BASE_UNIT_CONSTANTS(ALL, gon , _1)
TEST_BASE_UNIT_CONSTANTS(ALL, asec, _1)

TEST_BASE_UNIT_CONSTANT(deg , dim::_1, pi/180.0L )
TEST_BASE_UNIT_CONSTANT(amin , dim::_1, pi/10.8e3L)
TEST_BASE_UNIT_CONSTANT(deg , _1, pi/180.0L )
TEST_BASE_UNIT_CONSTANT(amin , _1, pi/10.8e3L)
}
2 changes: 1 addition & 1 deletion tests/sources/length_unit_constant_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


using namespace zollstock::units;
using namespace zollstock::dimensions;


TEST_CASE("length-unit-constants", "[length][unit][constants]")
{
Expand Down
1 change: 0 additions & 1 deletion tests/sources/mass_unit_constant_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


using namespace zollstock::units;
using namespace zollstock::dimensions;


TEST_CASE("mass-unit-constants", "[mass][unit][constants]")
Expand Down
1 change: 0 additions & 1 deletion tests/sources/time_unit_constant_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


using namespace zollstock::units;
using namespace zollstock::dimensions;


TEST_CASE("time-unit-constants", "[time][unit][constants]")
Expand Down

0 comments on commit f351dc8

Please sign in to comment.