test: compile quantity_test.cpp with -DUNITS_DOWNCAST_MODE=0

This commit is contained in:
Johel Ernesto Guerrero Peña
2021-03-15 14:24:26 +01:00
committed by Mateusz Pusz
parent b18061ab0e
commit 3002c5673d
6 changed files with 36 additions and 20 deletions
+6 -1
View File
@@ -44,6 +44,11 @@ using namespace unit_constants;
constexpr auto cgs_cm = cgs::unit_constants::cm;
#if UNITS_DOWNCAST_MODE == 0
template<typename T, typename U>
constexpr bool is_same_v = equivalent<T, U>;
#endif
//////////////////////////////
// quantity class invariants
@@ -743,7 +748,7 @@ static_assert(quantity_cast<dim_speed, kilometre_per_hour>(2000.0_q_m / 3600.0_q
static_assert(quantity_cast<dim_length>(1 * cgs_cm) == 1 * cm);
static_assert(is_same_v<decltype(quantity_cast<litre>(2_q_dm3)), volume<litre, std::int64_t>>);
static_assert(!is_same_v<decltype(quantity_cast<litre>(2_q_dm3)), volume<cubic_decimetre, std::int64_t>>);
static_assert(!std::same_as<decltype(quantity_cast<litre>(2_q_dm3)), volume<cubic_decimetre, std::int64_t>>);
////////////////
// downcasting