10 #ifndef READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 11 # define READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 1 12 #endif // !READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 24 #define BOOST_TEST_MODULE ( readout_types_test ) 25 #include "boost/test/unit_test.hpp" 32 template <
typename ID>
34 {
return geo::details::geoElementLevel<ID>() ==
ID::Level; }
40 static_assert(assertGeoIDlevel<readout::TPCsetID>());
41 static_assert(assertGeoIDlevel<readout::ROPID>());
42 static_assert(!geo::details::isTopGeoElementID<readout::TPCsetID>);
43 static_assert(!geo::details::isTopGeoElementID<readout::ROPID>);
71 "readout::CryostatID can be implicitly converted to an integral type" 77 "readout::TPCsetID can be implicitly converted to an integral type" 81 "readout::TPCsetID can be implicitly converted to an integral type" 87 "readout::ROPID can be implicitly converted to an integral type" 91 "readout::ROPID can be implicitly converted to an integral type" 95 "readout::ROPID can be implicitly converted to an integral type" 104 BOOST_TEST(
id.isValid == answer);
106 BOOST_TEST(!
id == !answer);
108 BOOST_TEST((
bool)
id == answer);
112 template <
typename TESTID,
typename REFID = TESTID>
114 BOOST_TEST(!(
id < smaller) );
115 BOOST_TEST(!(
id == smaller) );
116 BOOST_TEST(
id != smaller );
117 BOOST_TEST( smaller <
id );
118 BOOST_TEST(smaller.cmp(
id) < 0);
119 BOOST_TEST(
id.cmp(smaller) > 0);
123 template <
typename TESTID,
typename REFID = TESTID>
125 BOOST_TEST(!(
id < same) );
126 BOOST_TEST(
id == same );
127 BOOST_TEST(!(
id != same) );
128 BOOST_TEST(!(same <
id) );
129 BOOST_TEST(same.cmp(
id) == 0);
130 BOOST_TEST(
id.cmp(same) == 0);
134 template <
typename TESTID>
139 template <
typename TESTID,
typename REFID = TESTID>
141 BOOST_TEST(
id < larger );
142 BOOST_TEST(
id != larger );
143 BOOST_TEST(!(
id == larger) );
144 BOOST_TEST(!(larger <
id) );
145 BOOST_TEST(larger.cmp(
id) > 0);
146 BOOST_TEST(
id.cmp(larger) < 0);
151 template <
typename TESTID,
typename REFID = TESTID>
154 REFID
const& smaller,
167 BOOST_TEST_MESSAGE(
"Testing default-constructed cryostat ID");
185 BOOST_TEST_CHECKPOINT(
"Testing cryostat ID constructed with an integer");
203 BOOST_TEST_CHECKPOINT(
"Testing cryostat ID constructed with an integer 0");
217 BOOST_TEST_CHECKPOINT(
"Testing default-constructed TPC set ID");
229 BOOST_TEST_CHECKPOINT(
"Testing integral-constructed TPC set ID");
231 #if READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 232 BOOST_TEST_MESSAGE(
" (test skipped)");
236 BOOST_TEST_MESSAGE(
"TPCsetID(1) = " <<
std::string(sid));
240 BOOST_TEST_MESSAGE(
"int(TPCsetID(1)) = " << what);
242 #endif // READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 249 BOOST_TEST_CHECKPOINT(
"Testing ID-constructed TPC set ID");
263 BOOST_TEST_CHECKPOINT(
"Testing comparison with TPC set ID");
265 larger_sid(cid, sid.
TPCset + 1);
274 BOOST_TEST_CHECKPOINT(
"Testing TPC set ID constructed with indices");
281 BOOST_TEST_CHECKPOINT(
"Testing comparison with same cryostat ID");
286 BOOST_TEST_CHECKPOINT(
"Testing comparison with different cryostat ID");
292 BOOST_TEST(sid.
getIndex<0U>() == 1);
294 BOOST_TEST(sid.
getIndex<0U>() == 2);
296 BOOST_TEST(sid.
getIndex<1U>() == 15);
298 BOOST_TEST(sid.
getIndex<1U>() == 19);
301 BOOST_TEST_CHECKPOINT(
"Testing TPC set ID constructed with a TPC set #0");
317 BOOST_TEST_CHECKPOINT(
"Testing default-constructed ROP ID");
329 BOOST_TEST_CHECKPOINT(
"Testing integral-constructed ROP ID");
331 #if READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 332 BOOST_TEST_MESSAGE(
" (test skipped)");
336 BOOST_TEST_MESSAGE(
"ROPID(1) = " <<
std::string(rid));
340 BOOST_TEST_MESSAGE(
"int(ROPID(1)) = " << what);
342 #endif // READOUT_TYPES_TEST_SKIP_COMPILATION_ERRORS 349 BOOST_TEST_CHECKPOINT(
"Testing ID-constructed ROP ID");
363 BOOST_TEST_CHECKPOINT(
"Testing comparison with ROP ID");
365 larger_rid(sid, rid.
ROP + 1);
374 BOOST_TEST_CHECKPOINT(
"Testing ROP ID constructed with indices");
386 BOOST_TEST_CHECKPOINT(
"Testing comparison with same TPC set ID");
389 smaller_rid(1, 15, 31), same_rid(1, 15, 32), larger_rid(1, 15, 33);
392 BOOST_TEST_CHECKPOINT(
"Testing comparison with different TPC set ID (1)");
396 BOOST_TEST_CHECKPOINT(
"Testing comparison with different TPC set ID (2)");
401 BOOST_TEST_CHECKPOINT(
"Testing comparison with different cryostat ID");
405 BOOST_TEST_CHECKPOINT(
"Testing comparison with different cryostat ID (2)");
411 BOOST_TEST(rid.
getIndex<0U>() == 1);
413 BOOST_TEST(rid.
getIndex<0U>() == 2);
415 BOOST_TEST(rid.
getIndex<1U>() == 15);
417 BOOST_TEST(rid.
getIndex<1U>() == 19);
419 BOOST_TEST(rid.
getIndex<2U>() == 32);
421 BOOST_TEST(rid.
getIndex<2U>() == 76);
424 BOOST_TEST_CHECKPOINT(
"Testing ROP ID constructed with a ROP #0");
void TestCompareSelfID(TESTID const &id)
Test comparison operators.
void test_ROPID_directConstructor()
Classes identifying readout-related concepts.
void test_ROPID_integralConstructor()
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
unsigned int ROPID_t
Type for the ID number.
unsigned short TPCsetID_t
Type for the ID number.
void TestCompareSmallerID(TESTID const &id, REFID const &smaller)
Test comparison operators.
void TestCompareLargerID(TESTID const &id, REFID const &larger)
Test comparison operators.
constexpr auto getIndex() const
Returns the index level Index of this type.
Class identifying a set of TPC sharing readout channels.
CryostatID_t Cryostat
Index of cryostat.
details::AbsIDtype< L, ThisID_t > ID_t
Type of the ID with the specified level L.
void test_CryostatID_defaultConstructor()
auto & writeIndex()
Returns the index level Index of this type.
constexpr auto getIndex() const
Returns the index level Index of this type.
void test_ROPID_nestedConstructor()
ROPID_t ROP
Index of the readout plane within its TPC set.
void test_TPCsetID_integralConstructor()
constexpr auto getRelIndex() const
Returns the index Above levels higher than Level.
Class identifying a set of planes sharing readout channels.
details::RelIDtype< A, ThisID_t > UpperID_t
Type of the ID A levels above this one.
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
BOOST_AUTO_TEST_CASE(CryostatIDtest)
void TestIDvalidity(readout::CryostatID const &id, bool answer)
unsigned int CryostatID_t
Type for the ID number.
void test_TPCsetID_defaultConstructor()
void TestCompareSameID(TESTID const &id, REFID const &same)
Test comparison operators.
details::AbsIDtype< L, ThisID_t > ID_t
Type of the ID with the specified level L.
void test_CryostatID_directConstructor()
void test_TPCsetID_nestedConstructor()
void test_ROPID_defaultConstructor()
auto & writeIndex()
Returns the index level Index of this type.
constexpr bool assertGeoIDlevel()
void TestIDcomparison(TESTID const &id, REFID const &smaller, REFID const &same, REFID const &larger)
Test comparison operators.
void test_TPCsetID_directConstructor()
The data type to uniquely identify a cryostat.
details::RelIDtype< A, ThisID_t > UpperID_t
Type of the ID A levels above this one.