Skip to content

Commit 4865917

Browse files
committed
test: unit tests fixed for new subkinds
1 parent 23337d9 commit 4865917

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/static/hep_test.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,19 +131,26 @@ static_assert(verify(hep::phase, real_scalar, one)); // phase is dimensionless
131131

132132
// Test quantity hierarchy conversions
133133
// All specialized lengths can be implicitly converted up the hierarchy to generic length
134-
static_assert(implicitly_convertible(hep::radiation_length, hep::length));
135134
static_assert(implicitly_convertible(hep::decay_length, hep::length));
136-
static_assert(implicitly_convertible(hep::interaction_length, hep::length));
137135
static_assert(implicitly_convertible(hep::nuclear_interaction_length, hep::interaction_length));
138136

137+
// is_kind quantities form subkinds
138+
static_assert(!implicitly_convertible(hep::radiation_length, hep::length));
139+
static_assert(explicitly_convertible(hep::radiation_length, hep::length));
140+
static_assert(!implicitly_convertible(hep::interaction_length, hep::length));
141+
static_assert(explicitly_convertible(hep::interaction_length, hep::length));
142+
143+
static_assert(!implicitly_convertible(hep::proper_time, hep::duration));
144+
static_assert(explicitly_convertible(hep::proper_time, hep::duration));
145+
static_assert(!implicitly_convertible(hep::coordinate_time, hep::duration));
146+
static_assert(explicitly_convertible(hep::coordinate_time, hep::duration));
147+
139148
// But cannot be implicitly converted between each other (different physical concepts!)
140149
static_assert(!implicitly_convertible(hep::radiation_length, hep::decay_length));
141150
static_assert(!implicitly_convertible(hep::decay_length, hep::interaction_length));
142151
static_assert(!implicitly_convertible(hep::impact_parameter, hep::vertex_position));
143152

144153
// Specialized times: proper_time vs coordinate_time are distinct
145-
static_assert(implicitly_convertible(hep::proper_time, hep::duration));
146-
static_assert(implicitly_convertible(hep::coordinate_time, hep::duration));
147154
static_assert(!implicitly_convertible(hep::proper_time, hep::coordinate_time));
148155
static_assert(!implicitly_convertible(hep::coordinate_time, hep::proper_time));
149156

0 commit comments

Comments
 (0)