mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 02:17:16 +02:00
Unit tests compilation fixed on VS
This commit is contained in:
@ -229,7 +229,7 @@ static_assert(quantity_point_cast<int>(quantity_point(1.23q_m)).relative().count
|
||||
static_assert(quantity_point{1q_h} == quantity_point{3600q_s});
|
||||
|
||||
template<typename Metre>
|
||||
constexpr bool no_crossdimensional_equality = !requires
|
||||
concept no_crossdimensional_equality = !requires
|
||||
{
|
||||
quantity_point(1q_s) == quantity_point(length<Metre, int>(1));
|
||||
};
|
||||
@ -238,6 +238,7 @@ static_assert(no_crossdimensional_equality<metre>);
|
||||
|
||||
// length
|
||||
|
||||
static_assert(quantity_point(1q_km) != quantity_point(1q_m));
|
||||
static_assert(quantity_point(1q_km) == quantity_point(1000q_m));
|
||||
static_assert(quantity_point(1q_km) + 1q_m == quantity_point(1001q_m));
|
||||
static_assert(1q_km + quantity_point(1q_m) == quantity_point(1001q_m));
|
||||
|
@ -269,7 +269,7 @@ static_assert(quantity_cast<int>(1.23q_m).count() == 1);
|
||||
static_assert(1q_h == 3600q_s);
|
||||
|
||||
template<typename Metre>
|
||||
constexpr bool no_crossdimensional_equality = !requires { 1q_s == length<Metre, int>(1); };
|
||||
concept no_crossdimensional_equality = !requires { 1q_s == length<Metre, int>(1); };
|
||||
|
||||
static_assert(no_crossdimensional_equality<metre>);
|
||||
|
||||
|
@ -40,8 +40,9 @@ struct hour : named_scaled_unit<hour, "h", no_prefix, ratio(36, 1, 2), second> {
|
||||
struct dim_time : base_dimension<"time", second> {};
|
||||
|
||||
struct kelvin : named_unit<kelvin, "K", no_prefix> {};
|
||||
#if COMP_MSVC || COMP_GCC >= 10
|
||||
static_assert([]<Prefix P>(P) { return !requires { typename prefixed_unit<struct kilokelvin, P, kelvin>; }; }(si::kilo{})); // negative unit ratio
|
||||
|
||||
#if COMP_GCC >= 10
|
||||
static_assert([]<Prefix P>(P) { return !requires { typename prefixed_unit<struct kilokelvin, P, kelvin>; }; }(si::kilo{})); // no prefix allowed
|
||||
#endif
|
||||
|
||||
struct metre_per_second : unit<metre_per_second> {};
|
||||
@ -53,7 +54,8 @@ static_assert(is_same_v<downcast<scaled_unit<ratio(1, 1, -2), metre>>, centimetr
|
||||
static_assert(is_same_v<downcast<scaled_unit<ratio(yard::ratio.num, yard::ratio.den, yard::ratio.exp), metre>>, yard>);
|
||||
static_assert(is_same_v<downcast<scaled_unit<yard::ratio * ratio(1, 3), metre>>, foot>);
|
||||
static_assert(is_same_v<downcast<scaled_unit<kilometre::ratio / hour::ratio, metre_per_second>>, kilometre_per_hour>);
|
||||
#if COMP_MSVC || COMP_GCC >= 10
|
||||
|
||||
#if COMP_GCC >= 10
|
||||
static_assert([]<ratio R>() { return !requires { typename scaled_unit<R, metre>; }; }.template operator()<ratio(-1, 1)>()); // negative unit ratio
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user