99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111
12- #define BOOST_TEST_MODULE Test quality_control TimeRangeFlagCollection class
12+ #define BOOST_TEST_MODULE Test quality_control QualityControlFlagCollection class
1313#define BOOST_TEST_MAIN
1414#define BOOST_TEST_DYN_LINK
1515
1818// STL
1919#include < sstream>
2020// o2 includes
21- #include " DataFormatsQualityControl/TimeRangeFlagCollection.h"
22- #include " DataFormatsQualityControl/TimeRangeFlag.h"
21+ #include " DataFormatsQualityControl/QualityControlFlagCollection.h"
22+ #include " DataFormatsQualityControl/QualityControlFlag.h"
23+ #include " DataFormatsQualityControl/FlagTypeFactory.h"
2324
2425using namespace o2 ::quality_control;
2526
26- BOOST_AUTO_TEST_CASE (test_TimeRangeFlagCollection_Methods )
27+ BOOST_AUTO_TEST_CASE (test_QualityControlFlagCollection_Methods )
2728{
28- TimeRangeFlag trf1{12 , 34 , FlagReasonFactory ::BadTracking (), " comment" , " source" };
29- TimeRangeFlag trf2{10 , 34 , FlagReasonFactory ::BadTracking (), " comment" , " source" };
29+ QualityControlFlag trf1{12 , 34 , FlagTypeFactory ::BadTracking (), " comment" , " source" };
30+ QualityControlFlag trf2{10 , 34 , FlagTypeFactory ::BadTracking (), " comment" , " source" };
3031
31- TimeRangeFlagCollection trfc1{" Raw data checks" , " TOF" , {10 , 20000 }, 12345 , " LHC22k5" , " passMC" , " qc_mc" };
32+ QualityControlFlagCollection trfc1{" Raw data checks" , " TOF" , {10 , 20000 }, 12345 , " LHC22k5" , " passMC" , " qc_mc" };
3233 trfc1.insert (trf1); // by copy
3334 trfc1.insert (trf2);
34- trfc1.insert ({50 , 77 , FlagReasonFactory ::Invalid ()}); // by move
35+ trfc1.insert ({50 , 77 , FlagTypeFactory ::Invalid ()}); // by move
3536 BOOST_CHECK_EQUAL (trfc1.size (), 3 );
3637 BOOST_CHECK_EQUAL (trfc1.getName (), " Raw data checks" );
3738 BOOST_CHECK_EQUAL (trfc1.getDetector (), " TOF" );
@@ -42,31 +43,31 @@ BOOST_AUTO_TEST_CASE(test_TimeRangeFlagCollection_Methods)
4243 BOOST_CHECK_EQUAL (trfc1.getPassName (), " passMC" );
4344 BOOST_CHECK_EQUAL (trfc1.getProvenance (), " qc_mc" );
4445
45- TimeRangeFlagCollection trfc2{" Reco checks" , " TOF" };
46- trfc2.insert ({50 , 77 , FlagReasonFactory ::Invalid ()}); // this is a duplicate to an entry in trfc1
47- trfc2.insert ({51 , 77 , FlagReasonFactory ::Invalid ()});
48- trfc2.insert ({1234 , 3434 , FlagReasonFactory ::LimitedAcceptance ()});
49- trfc2.insert ({50 , 77 , FlagReasonFactory ::LimitedAcceptance ()});
46+ QualityControlFlagCollection trfc2{" Reco checks" , " TOF" };
47+ trfc2.insert ({50 , 77 , FlagTypeFactory ::Invalid ()}); // this is a duplicate to an entry in trfc1
48+ trfc2.insert ({51 , 77 , FlagTypeFactory ::Invalid ()});
49+ trfc2.insert ({1234 , 3434 , FlagTypeFactory ::LimitedAcceptance ()});
50+ trfc2.insert ({50 , 77 , FlagTypeFactory ::LimitedAcceptance ()});
5051 BOOST_CHECK_EQUAL (trfc2.size (), 4 );
5152
5253 // Try merging. Duplicate entries should be left in the 'other' objects.
5354 // Notice that we merge the two partial TRFCs into the third, which covers all cases
54- TimeRangeFlagCollection trfc3{" ALL" , " TOF" };
55+ QualityControlFlagCollection trfc3{" ALL" , " TOF" };
5556 trfc3.merge (trfc1);
5657 trfc3.merge (trfc2);
5758 BOOST_CHECK_EQUAL (trfc1.size (), 0 );
5859 BOOST_CHECK_EQUAL (trfc2.size (), 1 );
5960 BOOST_CHECK_EQUAL (trfc3.size (), 6 );
6061
6162 // Try const merging. It should copy the elements and keep the 'other' intact.
62- TimeRangeFlagCollection trfc4{" ALL" , " TOF" };
63+ QualityControlFlagCollection trfc4{" ALL" , " TOF" };
6364 const auto & constTrfc3 = trfc3;
6465 trfc4.merge (constTrfc3);
6566 BOOST_CHECK_EQUAL (trfc3.size (), 6 );
6667 BOOST_CHECK_EQUAL (trfc4.size (), 6 );
6768
6869 // Try merging different detectors - it should throw.
69- TimeRangeFlagCollection trfc5{" ALL" , " TPC" };
70+ QualityControlFlagCollection trfc5{" ALL" , " TPC" };
7071 BOOST_CHECK_THROW (trfc5.merge (trfc3), std::runtime_error);
7172 BOOST_CHECK_THROW (trfc5.merge (constTrfc3), std::runtime_error);
7273
@@ -79,31 +80,31 @@ BOOST_AUTO_TEST_CASE(test_TimeRangeFlagCollection_Methods)
7980 }
8081}
8182
82- BOOST_AUTO_TEST_CASE (test_TimeRangeFlagCollection_IO )
83+ BOOST_AUTO_TEST_CASE (test_QualityControlFlagCollection_IO )
8384{
8485 {
85- TimeRangeFlagCollection trfc1{" xyz" , " TST" };
86+ QualityControlFlagCollection trfc1{" xyz" , " TST" };
8687
8788 std::stringstream store;
8889 trfc1.streamTo (store);
8990
90- TimeRangeFlagCollection trfc2{" xyz" , " TST" };
91+ QualityControlFlagCollection trfc2{" xyz" , " TST" };
9192 trfc2.streamFrom (store);
9293
9394 BOOST_CHECK_EQUAL (trfc2.size (), 0 );
9495 }
9596 {
96- TimeRangeFlagCollection trfc1{" xyz" , " TST" };
97- trfc1.insert ({50 , 77 , FlagReasonFactory ::Invalid (), " a comment" , " a source" });
98- trfc1.insert ({51 , 77 , FlagReasonFactory ::Invalid ()});
99- trfc1.insert ({1234 , 3434 , FlagReasonFactory ::LimitedAcceptance ()});
100- trfc1.insert ({50 , 77 , FlagReasonFactory ::LimitedAcceptance ()});
101- trfc1.insert ({43434 , 63421 , FlagReasonFactory ::NotBadFlagExample ()});
97+ QualityControlFlagCollection trfc1{" xyz" , " TST" };
98+ trfc1.insert ({50 , 77 , FlagTypeFactory ::Invalid (), " a comment" , " a source" });
99+ trfc1.insert ({51 , 77 , FlagTypeFactory ::Invalid ()});
100+ trfc1.insert ({1234 , 3434 , FlagTypeFactory ::LimitedAcceptance ()});
101+ trfc1.insert ({50 , 77 , FlagTypeFactory ::LimitedAcceptance ()});
102+ trfc1.insert ({43434 , 63421 , FlagTypeFactory ::NotBadFlagExample ()});
102103
103104 std::stringstream store;
104105 trfc1.streamTo (store);
105106
106- TimeRangeFlagCollection trfc2{" xyz" , " TST" };
107+ QualityControlFlagCollection trfc2{" xyz" , " TST" };
107108 trfc2.streamFrom (store);
108109
109110 BOOST_REQUIRE_EQUAL (trfc1.size (), trfc2.size ());
@@ -115,7 +116,7 @@ BOOST_AUTO_TEST_CASE(test_TimeRangeFlagCollection_IO)
115116 std::stringstream store;
116117 store << " start,end,flag_id,invalid,header,format\n " ;
117118 store << R"( 123,345,11,"fdsa",1,"comment","source")" ;
118- TimeRangeFlagCollection trfc1{" A" , " TST" };
119+ QualityControlFlagCollection trfc1{" A" , " TST" };
119120 BOOST_CHECK_THROW (trfc1.streamFrom (store), std::runtime_error);
120121 }
121122 {
@@ -128,7 +129,7 @@ BOOST_AUTO_TEST_CASE(test_TimeRangeFlagCollection_IO)
128129 store << R"( 123,345,,"fdsa",1,"comment","source")" << ' \n ' ;
129130 store << R"( 123,345,11,"",1,"comment","source")" << ' \n ' ;
130131 store << R"( 123,345,11,"fdsa",,"comment","source")" << ' \n ' ;
131- TimeRangeFlagCollection trfc1{" A" , " TST" };
132+ QualityControlFlagCollection trfc1{" A" , " TST" };
132133 BOOST_CHECK_NO_THROW (trfc1.streamFrom (store));
133134 BOOST_CHECK_EQUAL (trfc1.size (), 0 );
134135 }
0 commit comments