26 #define BOOST_TEST_MODULE ( trajectorypointflags_test )
27 #include "boost/test/unit_test.hpp"
42 std::set<util::flags::Index_t>
const& expectedDefined,
43 std::set<util::flags::Index_t>
const& expectedSet
51 BOOST_TEST(flags.
nFlags() == trkflag::maxFlags());
55 i <= trkflag::maxFlags();
58 bool const allocated = (i < trkflag::maxFlags());
59 bool const defined = (expectedDefined.count(i) > 0);
60 bool const set = (expectedSet.count(i) > 0);
62 BOOST_TEST_MESSAGE(
"Testing flag #" << i);
84 BOOST_TEST(flags.
isFlag(i) == allocated);
100 BOOST_TEST(flags.
test(i) == set);
105 BOOST_TEST(flags.
get(i) == set);
110 BOOST_TEST(flags.
isSet(i) == set);
115 BOOST_TEST(flags.
isUnset(i) == !set);
134 std::set<util::flags::Index_t> expectedDefined, expectedSet;
135 for (
unsigned int i = 0; i < expectedMask.capacity(); ++i) {
136 if (expectedMask.isUndefined(i))
continue;
137 expectedDefined.insert(i);
138 if (expectedMask.isSet(i)) expectedSet.insert(i);
144 for (
unsigned int level = 0; level < 2; ++level) {
145 std::cout <<
"Default-constructed flags, dump(verbosity=" << level <<
"):"
152 BOOST_TEST_MESSAGE(
"Flag check for default constructed object");
164 BOOST_TEST(!flags.isHitIgnored());
169 BOOST_TEST(flags.isPointValid());
174 BOOST_TEST(!flags.isMerged());
179 BOOST_TEST(!flags.isShared());
184 BOOST_TEST(!flags.isDeltaRay());
189 BOOST_TEST(!flags.hasDetectorIssues());
194 BOOST_TEST(!flags.isOtherwiseSuspicious());
199 BOOST_TEST(flags.isExclusive());
204 BOOST_TEST(!flags.isExcludedFromFit());
209 BOOST_TEST(flags.belongsToTrack());
214 BOOST_TEST(!flags.isHitReinterpreted());
219 BOOST_TEST(flags.isIncludedInFit());
224 BOOST_TEST(!flags.isPointFlawed());
229 BOOST_TEST(flags.isPointFlawless());
234 BOOST_TEST(!flags.hasOriginalHitIndex());
239 BOOST_TEST(flags.fromHit() == InvalidHitIndex);
250 std::set<recob::TrajectoryPointFlags::Flag_t>
const expectedBits
251 = { trkflag::NoPoint, trkflag::HitIgnored };
254 (trkflag::NoPoint, trkflag::HitIgnored);
260 (InvalidHitIndex, trkflag::NoPoint, trkflag::HitIgnored);
262 std::set<util::flags::Index_t> expectedDefined;
263 expectedDefined.insert(trkflag::NoPoint.index());
264 expectedDefined.insert(trkflag::HitIgnored.index());
265 std::set<util::flags::Index_t> expectedSet = expectedDefined;
270 for (
unsigned int level = 0; level < 2; ++level) {
271 std::cout <<
"Flag-constructed flags, dump(verbosity=" << level <<
"):"
277 BOOST_TEST_MESSAGE(
"Flag check for flag-constructed object");
284 BOOST_TEST(flags.mask() == flagbitmask);
289 BOOST_TEST(!flags.hasOriginalHitIndex());
294 BOOST_TEST(flags.fromHit() == InvalidHitIndex);
308 trkflag::NoPoint, trkflag::Rejected,
312 std::set<util::flags::Index_t> expectedSet;
313 expectedSet.insert(trkflag::NoPoint.index());
314 expectedSet.insert(trkflag::Rejected.index());
315 std::set<util::flags::Index_t> expectedDefined = expectedSet;
316 expectedDefined.insert(trkflag::HitIgnored.index());
318 std::set<Flag_t>
const expectedValues(expectedSet.begin(), expectedSet.end());
319 std::set<Flag_t>
const expectedFlags
320 (expectedDefined.begin(), expectedDefined.end());
328 trkflag::NoPoint + trkflag::Rejected + -trkflag::HitIgnored));
338 for (
unsigned int level = 0; level < 2; ++level) {
339 std::cout <<
"Bitmask-constructed flags, dump(verbosity=" << level <<
"):"
346 BOOST_TEST_MESSAGE(
"Flag check for bitmask-constructed object");
353 BOOST_TEST(flags.mask() == flagbitmask);
359 (flags.isHitIgnored() == (expectedValues.count(trkflag::HitIgnored) > 0));
365 (flags.isPointValid() == (expectedValues.count(trkflag::NoPoint) == 0));
370 BOOST_TEST(flags.hasOriginalHitIndex());
375 BOOST_TEST(flags.fromHit() == 12U);
421 (trkflag::NoPoint, trkflag::Merged);
constexpr bool isFlag(FlagIndex_t flagIndex) const
void TrajectoryPointFlagsTest_DefaultConstructor()
TrajectoryPointFlagTraits flag
Type of flag traits (indices and meaning of flags).
static constexpr Mask_t makeMask(Flags...flags)
Returns a bit mask with only the specified bit set.
bool isSet(Flag_t flag) const
Returns true if the flag exists and is set.
static constexpr Mask_t DefaultFlagsMask()
Flags used in default construction.
typename Mask_t::OutOfRangeError OutOfRangeError
Out-of-range flag index.
void TrajectoryPointFlagsDocumentationTest_makeMask()
bool test(FlagIndex_t index) const
Returns whether the specified flag is set.
void TrajectoryPointFlagsDocumentationTest()
typename Mask_t::FlagNotDefinedError FlagNotDefinedError
Flag not defined.
void TrajectoryPointFlagsTest_FlagsConstructor()
constexpr mask_t< EnumType > mask(EnumType bit, OtherBits...otherBits)
Returns a mask with all specified bits set.
bool get(Flag_t flag) const
Returns whether the specified flag is set.
void TrajectoryPointFlagsDocumentationTest_TrajectoryPointFlags_FromMaskTag_t()
static constexpr HitIndex_t InvalidHitIndex
Value marking an invalid hit index.
Set of flags pertaining a point of the track.
Flags_t::Flag_t Flag_t
Type of single flag.
void TrajectoryPointFlagsDocumentationTest_TrajectoryPointFlags_HitIndex_t_Flags()
bool isUnset(Flag_t flag) const
Returns true if the flag exists and is not set.
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker see the discussion of warn common echo in *Note Linker such as a global int variable echo as opposed to a large global array echo echo I echo The symbol is an indirect reference to another symbol This echo is a GNU extension to the a out object file format which is echo rarely used echo echo N echo The symbol is a debugging symbol echo echo R echo The symbol is in a read only data section echo echo S echo The symbol is in an uninitialized data section for small echo objects echo echo T echo The symbol is in the the normal defined echo symbol is used with no error When a weak undefined symbol echo is linked and the symbol is not defined
constexpr bool isAllocated(FlagIndex_t flagIndex) const
Returns whether there is room for a flag with the specified index.
bool isDefined(Flag_t flag) const
Returns true if the flag has been assigned a value.
Flags_t::FlagIndex_t FlagIndex_t
Type of index of single flag.
void CheckFlagsByIndex(recob::TrajectoryPointFlags const &flags, std::set< util::flags::Index_t > const &expectedDefined, std::set< util::flags::Index_t > const &expectedSet)
void TrajectoryPointFlagsTest_BitmaskConstructor()
Set of flags pertaining a point of the track.
constexpr BitMask< Storage > Unset(Flag_t< Storage > flag)
Returns a bit mask which unsets the specified flag.
BEGIN_PROLOG could also be cout
constexpr FlagIndex_t nFlags() const
Returns the number of defined flags.