Skip to content

Commit

Permalink
Merge pull request #664 from jvocht/master
Browse files Browse the repository at this point in the history
Add static tests for concept DimensionOf
  • Loading branch information
mpusz authored Jan 13, 2025
2 parents 0ba48b7 + 44cbf82 commit 3cc82e7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/static/concepts_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,24 @@ static_assert(!Dimension<struct si::metre>);
static_assert(!Dimension<int>);

// DimensionOf
// TODO add tests
static_assert(DimensionOf<struct isq::dim_length, isq::dim_length>);
static_assert(DimensionOf<struct isq::dim_length, isq::height.dimension>);
static_assert(DimensionOf<struct isq::dim_length, isq::radius.dimension>);
static_assert(!DimensionOf<struct isq::dim_length, isq::length>);
static_assert(!DimensionOf<struct isq::length, isq::dim_length>);
static_assert(!DimensionOf<struct isq::length, isq::length>);
static_assert(!DimensionOf<struct isq::dim_length, isq::dim_time>);
static_assert(!DimensionOf<struct isq::dim_length, isq::time>);
static_assert(!DimensionOf<struct isq::dim_time, isq::dim_length>);
static_assert(!DimensionOf<struct isq::dim_time, isq::length>);
static_assert(!DimensionOf<struct isq::length, isq::dim_time>);
static_assert(!DimensionOf<struct isq::length, isq::time>);
static_assert(!DimensionOf<struct isq::time, isq::dim_length>);
static_assert(!DimensionOf<struct isq::time, isq::length>);
static_assert(DimensionOf<decltype(isq::dim_length / isq::dim_time), isq::speed.dimension>);
static_assert(DimensionOf<decltype(isq::force.dimension * isq::time.dimension), isq::impulse.dimension>);
static_assert(DimensionOf<decltype(isq::angular_momentum.dimension / isq::angular_velocity.dimension),
isq::moment_of_inertia.dimension>);

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

0 comments on commit 3cc82e7

Please sign in to comment.