Skip to content

Commit

Permalink
Add static tests for concept DimensionOf
Browse files Browse the repository at this point in the history
  • Loading branch information
jvocht committed Jan 4, 2025
1 parent db18eec commit c758cb3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/static/concepts_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,22 @@ static_assert(!Dimension<struct si::metre>);
static_assert(!Dimension<int>);

// DimensionOf
// TODO add tests
inline constexpr struct isq::dim_length tdimlength;
inline constexpr struct isq::dim_time tdimtime;
inline constexpr struct isq::length tlength;
inline constexpr struct isq::time ttime;
static_assert(DimensionOf<struct isq::dim_length, tdimlength>);
static_assert(!DimensionOf<struct isq::dim_length, tdimtime>);
static_assert(!DimensionOf<struct isq::dim_length, tlength>);
static_assert(!DimensionOf<struct isq::dim_length, ttime>);
static_assert(!DimensionOf<struct isq::dim_time, tdimlength>);
static_assert(!DimensionOf<struct isq::dim_time, tlength>);
static_assert(!DimensionOf<struct isq::length, tdimlength>);
static_assert(!DimensionOf<struct isq::length, tdimtime>);
static_assert(!DimensionOf<struct isq::length, tlength>);
static_assert(!DimensionOf<struct isq::length, ttime>);
static_assert(!DimensionOf<struct isq::time, tdimlength>);
static_assert(!DimensionOf<struct isq::time, tlength>);

// QuantitySpec
inline constexpr auto speed = isq::length / isq::time;
Expand Down

0 comments on commit c758cb3

Please sign in to comment.