mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-03 20:34:26 +02:00
test: what we mean
a concept can fail for whatever requirement, and maybe the "main" one actually works (== in this case)
This commit is contained in:
committed by
Mateusz Pusz
parent
aff83b31dc
commit
4aeb9d305a
@@ -226,12 +226,16 @@ static_assert(quantity_point_cast<int>(quantity_point(1.23q_m)).relative().count
|
|||||||
|
|
||||||
// time
|
// time
|
||||||
|
|
||||||
#if COMP_MSVC || COMP_GCC >= 10
|
|
||||||
static_assert(!std::equality_comparable_with<quantity_point<dim_time, second, int>,
|
|
||||||
quantity_point<dim_length, metre, int>>); // different dimensions
|
|
||||||
#endif
|
|
||||||
static_assert(quantity_point{1q_h} == quantity_point{3600q_s});
|
static_assert(quantity_point{1q_h} == quantity_point{3600q_s});
|
||||||
|
|
||||||
|
template<typename Metre>
|
||||||
|
constexpr bool no_crossdimensional_equality = !requires
|
||||||
|
{
|
||||||
|
quantity_point(1q_s) == quantity_point(length<Metre, int>(1));
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(no_crossdimensional_equality<metre>);
|
||||||
|
|
||||||
// length
|
// length
|
||||||
|
|
||||||
static_assert(quantity_point(1q_km) == quantity_point(1000q_m));
|
static_assert(quantity_point(1q_km) == quantity_point(1000q_m));
|
||||||
|
Reference in New Issue
Block a user