Skip to content

Commit

Permalink
Print unit labels if test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
chiphogg committed Dec 15, 2023
1 parent b733a51 commit 1d991b7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions au/quantity_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ constexpr auto miles = QuantityMaker<Miles>{};
struct Inches : decltype(Feet{} / mag<12>()) {};
constexpr auto inches = QuantityMaker<Inches>{};

struct Yards : decltype(Feet{} * mag<3>()) {};
struct Yards : decltype(Feet{} * mag<3>()) {
static constexpr const char label[] = "yd";
};
constexpr const char Yards::label[];
constexpr auto yards = QuantityMaker<Yards>{};

struct Meters : decltype(Inches{} * mag<100>() / mag<254>() * mag<100>()) {};
struct Meters : decltype(Inches{} * mag<100>() / mag<254>() * mag<100>()) {
static constexpr const char label[] = "m";
};
constexpr const char Meters::label[];
static constexpr QuantityMaker<Meters> meters{};
static_assert(are_units_quantity_equivalent(Centi<Meters>{} * mag<254>(), Inches{} * mag<100>()),
"Double-check this ad hoc definition of meters");
Expand Down

0 comments on commit 1d991b7

Please sign in to comment.