Skip to content

Commit

Permalink
test: quantity_test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Aug 1, 2023
1 parent a6e4851 commit 571bf47
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions test/unit_test/static/quantity_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,31 +658,27 @@ static_assert(10 * isq::length[m] / (2 * isq::time[s]) - 5 * isq::speed[m / s] =
static_assert(5 * isq::speed[m / s] - 10 * isq::length[m] / (2 * isq::time[s]) == 0 * isq::speed[m / s]);

static_assert(
is_of_type<10 * isq::length[m] / (2 * isq::time[s]) + 5 * isq::speed[m / s],
quantity<reference<isq::speed, derived_unit<struct si::metre, per<struct si::second>>{}>{}, int>>);
is_of_type<10 * isq::length[m] / (2 * isq::time[s]) + 5 * isq::speed[m / s], quantity<isq::speed[m / s], int>>);
static_assert(
is_of_type<5 * isq::speed[m / s] + 10 * isq::length[m] / (2 * isq::time[s]),
quantity<reference<isq::speed, derived_unit<struct si::metre, per<struct si::second>>{}>{}, int>>);
is_of_type<5 * isq::speed[m / s] + 10 * isq::length[m] / (2 * isq::time[s]), quantity<isq::speed[m / s], int>>);
static_assert(
is_of_type<10 * isq::length[m] / (2 * isq::time[s]) - 5 * isq::speed[m / s],
quantity<reference<isq::speed, derived_unit<struct si::metre, per<struct si::second>>{}>{}, int>>);
is_of_type<10 * isq::length[m] / (2 * isq::time[s]) - 5 * isq::speed[m / s], quantity<isq::speed[m / s], int>>);
static_assert(
is_of_type<5 * isq::speed[m / s] - 10 * isq::length[m] / (2 * isq::time[s]),
quantity<reference<isq::speed, derived_unit<struct si::metre, per<struct si::second>>{}>{}, int>>);
is_of_type<5 * isq::speed[m / s] - 10 * isq::length[m] / (2 * isq::time[s]), quantity<isq::speed[m / s], int>>);

static_assert(10 / (2 * isq::time[s]) + 5 * isq::frequency[Hz] == 10 * isq::frequency[Hz]);
static_assert(5 * isq::frequency[Hz] + 10 / (2 * isq::time[s]) == 10 * isq::frequency[Hz]);
static_assert(10 / (2 * isq::time[s]) - 5 * isq::frequency[Hz] == 0 * isq::frequency[Hz]);
static_assert(5 * isq::frequency[Hz] - 10 / (2 * isq::time[s]) == 0 * isq::frequency[Hz]);

static_assert(is_of_type<10 / (2 * isq::period_duration[s]) + 5 * isq::frequency[Hz],
quantity<reference<isq::frequency, si::hertz>{}, int>>);
static_assert(is_of_type<5 * isq::frequency[Hz] + 10 / (2 * isq::period_duration[s]),
quantity<reference<isq::frequency, si::hertz>{}, int>>);
static_assert(is_of_type<10 / (2 * isq::period_duration[s]) - 5 * isq::frequency[Hz],
quantity<reference<isq::frequency, si::hertz>{}, int>>);
static_assert(is_of_type<5 * isq::frequency[Hz] - 10 / (2 * isq::period_duration[s]),
quantity<reference<isq::frequency, si::hertz>{}, int>>);
static_assert(
is_of_type<10 / (2 * isq::period_duration[s]) + 5 * isq::frequency[Hz], quantity<isq::frequency[Hz], int>>);
static_assert(
is_of_type<5 * isq::frequency[Hz] + 10 / (2 * isq::period_duration[s]), quantity<isq::frequency[Hz], int>>);
static_assert(
is_of_type<10 / (2 * isq::period_duration[s]) - 5 * isq::frequency[Hz], quantity<isq::frequency[Hz], int>>);
static_assert(
is_of_type<5 * isq::frequency[Hz] - 10 / (2 * isq::period_duration[s]), quantity<isq::frequency[Hz], int>>);

// Different named dimensions
template<typename... Ts>
Expand Down Expand Up @@ -814,6 +810,7 @@ template</*Reference*/ auto R1, /*Reference*/ auto R2> // TODO Use `Reference`
concept invalid_comparison = !requires { 2 * R1 == 2 * R2; } && !requires { 2 * R2 == 2 * R1; };
static_assert(invalid_comparison<activity[Bq], isq::frequency[Hz]>);


///////////////////////
// ordering operators
///////////////////////
Expand Down

0 comments on commit 571bf47

Please sign in to comment.