54 DataDescriptorMatcher::Op::And,
56 std::make_unique<DataDescriptorMatcher>(
57 DataDescriptorMatcher::Op::And,
59 std::make_unique<DataDescriptorMatcher>(
60 DataDescriptorMatcher::Op::And,
64 REQUIRE(matcher.match(header0, context) ==
true);
65 REQUIRE(matcher.match(header1, context) ==
false);
66 REQUIRE(matcher.match(header2, context) ==
false);
67 REQUIRE(matcher.match(header3, context) ==
false);
68 REQUIRE(matcher.match(header4, context) ==
false);
69 REQUIRE(matcher2.
match(header0, context) ==
true);
70 REQUIRE(matcher2.
match(header1, context) ==
false);
71 REQUIRE(matcher2.
match(header2, context) ==
false);
72 REQUIRE(matcher2.
match(header3, context) ==
false);
73 REQUIRE(matcher2.
match(header4, context) ==
false);
75 REQUIRE(matcher2 == matcher);
79 DataDescriptorMatcher::Op::Just,
82 DataDescriptorMatcher::Op::Just,
84 REQUIRE(matcherA == matcherB);
89 DataDescriptorMatcher::Op::Just,
92 DataDescriptorMatcher::Op::Just,
94 REQUIRE(matcherA == matcherB);
99 DataDescriptorMatcher::Op::Just,
102 DataDescriptorMatcher::Op::Just,
104 REQUIRE(matcherA == matcherB);
109 DataDescriptorMatcher::Op::Just,
112 DataDescriptorMatcher::Op::Just,
114 REQUIRE(matcherA == matcherB);
119 DataDescriptorMatcher::Op::And,
123 DataDescriptorMatcher::Op::Just,
126 REQUIRE(!(matcherA == matcherB));
131 DataDescriptorMatcher::Op::And,
133 std::make_unique<DataDescriptorMatcher>(
134 DataDescriptorMatcher::Op::And,
136 std::make_unique<DataDescriptorMatcher>(
137 DataDescriptorMatcher::Op::And,
142 DataDescriptorMatcher::Op::And,
144 std::make_unique<DataDescriptorMatcher>(
145 DataDescriptorMatcher::Op::And,
147 std::make_unique<DataDescriptorMatcher>(
148 DataDescriptorMatcher::Op::And,
151 REQUIRE(matcherA == matcherB);
156 DataDescriptorMatcher::Op::Not,
159 DataDescriptorMatcher::Op::Not,
162 DataDescriptorMatcher::Op::Not,
165 REQUIRE(matcherA.match(header0, context) ==
false);
166 REQUIRE(matcherA.match(header1, context) ==
true);
167 REQUIRE(matcherA.match(header4, context) ==
true);
168 REQUIRE(matcherB.match(header0, context) ==
true);
169 REQUIRE(matcherB.match(header1, context) ==
false);
170 REQUIRE(matcherB.match(header4, context) ==
false);
171 REQUIRE(matcherC.match(header0, context) ==
false);
172 REQUIRE(matcherC.match(header1, context) ==
true);
173 REQUIRE(matcherC.match(header4, context) ==
true);
205 DataDescriptorMatcher::Op::And,
207 std::make_unique<DataDescriptorMatcher>(
208 DataDescriptorMatcher::Op::And,
210 std::make_unique<DataDescriptorMatcher>(
211 DataDescriptorMatcher::Op::And,
216 REQUIRE(matcher.match(header0, context) ==
true);
217 REQUIRE(matcher.match(header1, context) ==
false);
218 REQUIRE(matcher.match(header2, context) ==
false);
219 REQUIRE(matcher.match(header3, context) ==
false);
220 REQUIRE(matcher.match(header4, context) ==
false);
223 DataDescriptorMatcher::Op::Or,
227 REQUIRE(matcher1.match(header0, context) ==
true);
228 REQUIRE(matcher1.match(header1, context) ==
true);
229 REQUIRE(matcher1.match(header2, context) ==
true);
230 REQUIRE(matcher1.match(header3, context) ==
true);
231 REQUIRE(matcher1.match(header4, context) ==
false);
234 DataDescriptorMatcher::Op::Just,
237 REQUIRE(matcher2.match(header0, context) ==
false);
238 REQUIRE(matcher2.match(header1, context) ==
true);
239 REQUIRE(matcher2.match(header2, context) ==
true);
240 REQUIRE(matcher2.match(header3, context) ==
false);
241 REQUIRE(matcher2.match(header4, context) ==
true);
275 REQUIRE(matcher1.matcher->match(header0, context) ==
true);
276 REQUIRE(matcher1.matcher->match(header1, context) ==
false);
277 REQUIRE(matcher1.matcher->match(header2, context) ==
false);
278 REQUIRE(matcher1.matcher->match(header3, context) ==
false);
279 REQUIRE(matcher1.matcher->match(header4, context) ==
false);
282 REQUIRE(matcher2.matcher->match(header0, context) ==
false);
283 REQUIRE(matcher2.matcher->match(header1, context) ==
true);
284 REQUIRE(matcher2.matcher->match(header2, context) ==
false);
285 REQUIRE(matcher2.matcher->match(header3, context) ==
false);
286 REQUIRE(matcher2.matcher->match(header4, context) ==
false);
289 REQUIRE(matcher3.matcher->match(header0, context) ==
true);
290 REQUIRE(matcher3.matcher->match(header1, context) ==
true);
291 REQUIRE(matcher3.matcher->match(header2, context) ==
false);
292 REQUIRE(matcher3.matcher->match(header3, context) ==
false);
293 REQUIRE(matcher3.matcher->match(header4, context) ==
false);
296 REQUIRE(matcher4.matcher->match(header0, context) ==
false);
297 REQUIRE(matcher4.matcher->match(header1, context) ==
false);
298 REQUIRE(matcher4.matcher->match(header2, context) ==
false);
299 REQUIRE(matcher4.matcher->match(header3, context) ==
false);
300 REQUIRE(matcher4.matcher->match(header4, context) ==
false);
309 DataDescriptorMatcher::Op::And,
311 std::make_unique<DataDescriptorMatcher>(
312 DataDescriptorMatcher::Op::And,
314 std::make_unique<DataDescriptorMatcher>(
315 DataDescriptorMatcher::Op::And,
324 REQUIRE(matcher.match(header0, context) ==
true);
325 auto s = std::get_if<std::string>(&context.
get(0));
326 REQUIRE(s !=
nullptr);
327 REQUIRE(*s ==
"TPC");
328 auto v = std::get_if<o2::header::DataHeader::SubSpecificationType>(&context.
get(1));
329 REQUIRE(
v !=
nullptr);
339 REQUIRE(matcher.match(header1, context) ==
false);
340 auto s1 = std::get_if<std::string>(&context.
get(0));
341 REQUIRE(
s1 !=
nullptr);
342 REQUIRE(*
s1 ==
"TPC");
354 DataDescriptorMatcher::Op::And,
356 std::make_unique<DataDescriptorMatcher>(
357 DataDescriptorMatcher::Op::And,
359 std::make_unique<DataDescriptorMatcher>(
360 DataDescriptorMatcher::Op::And,
366 REQUIRE(matcher.match(spec0, context) ==
true);
367 REQUIRE(matcher.match(spec1, context) ==
false);
368 REQUIRE(matcher.match(spec2, context) ==
false);
369 REQUIRE(matcher.match(spec3, context) ==
false);
370 REQUIRE(matcher.match(spec4, context) ==
false);
373 DataDescriptorMatcher::Op::Or,
377 REQUIRE(matcher1.match(spec0, context) ==
true);
378 REQUIRE(matcher1.match(spec1, context) ==
true);
379 REQUIRE(matcher1.match(spec2, context) ==
true);
380 REQUIRE(matcher1.match(spec3, context) ==
true);
381 REQUIRE(matcher1.match(spec4, context) ==
false);
384 DataDescriptorMatcher::Op::Just,
387 REQUIRE(matcher2.match(spec0, context) ==
false);
388 REQUIRE(matcher2.match(spec1, context) ==
true);
389 REQUIRE(matcher2.match(spec2, context) ==
true);
390 REQUIRE(matcher2.match(spec3, context) ==
false);
391 REQUIRE(matcher2.match(spec4, context) ==
true);
427 DataDescriptorMatcher::Op::And,
429 std::make_unique<DataDescriptorMatcher>(
430 DataDescriptorMatcher::Op::And,
432 std::make_unique<DataDescriptorMatcher>(
433 DataDescriptorMatcher::Op::Just,
443 auto vPtr0 = std::get_if<None>(&context.
get(0));
444 auto vPtr1 = std::get_if<None>(&context.
get(1));
445 REQUIRE(vPtr0 !=
nullptr);
446 REQUIRE(vPtr1 !=
nullptr);
447 REQUIRE(matcher.match(dh, context) ==
false);
450 vPtr0 = std::get_if<None>(&context.
get(0));
451 vPtr1 = std::get_if<None>(&context.
get(1));
452 REQUIRE(vPtr0 !=
nullptr);
453 REQUIRE(vPtr1 !=
nullptr);
464 auto v1 = std::get_if<std::string>(&context.
get(0));
465 REQUIRE(
v1 !=
nullptr);
466 REQUIRE(*
v1 ==
"A TEST");
467 auto v2 = std::get_if<std::string>(&context.
get(1));
468 REQUIRE(
v2 ==
nullptr);
469 auto v3 = std::get_if<uint32_t>(&context.
get(10));
470 REQUIRE(
v3 !=
nullptr);
474 v1 = std::get_if<std::string>(&context.
get(0));
475 REQUIRE(
v1 !=
nullptr);
476 REQUIRE(*
v1 ==
"A TEST");
477 v2 = std::get_if<std::string>(&context.
get(1));
478 REQUIRE(
v2 ==
nullptr);
479 v3 = std::get_if<uint32_t>(&context.
get(10));
480 REQUIRE(
v3 !=
nullptr);
486 v1 = std::get_if<std::string>(&context.
get(0));
487 REQUIRE(
v1 !=
nullptr);
488 REQUIRE(*
v1 ==
"SOME MORE");
489 v2 = std::get_if<std::string>(&context.
get(1));
490 REQUIRE(
v2 ==
nullptr);
491 v3 = std::get_if<uint32_t>(&context.
get(10));
492 REQUIRE(
v3 !=
nullptr);
497 v1 = std::get_if<std::string>(&context.
get(0));
498 REQUIRE(
v1 !=
nullptr);
499 REQUIRE(*
v1 ==
"A TEST");
500 auto n = std::get_if<None>(&context.
get(1));
501 REQUIRE(
n !=
nullptr);
502 v3 = std::get_if<uint32_t>(&context.
get(10));
503 REQUIRE(
v3 !=
nullptr);
509 v1 = std::get_if<std::string>(&context.
get(0));
510 REQUIRE(
v1 !=
nullptr);
511 REQUIRE(*
v1 ==
"SOME MORE");
512 v2 = std::get_if<std::string>(&context.
get(1));
513 REQUIRE(
v2 ==
nullptr);
514 v3 = std::get_if<uint32_t>(&context.
get(10));
515 REQUIRE(
v3 !=
nullptr);
520 auto n1 = std::get_if<None>(&context.
get(0));
521 REQUIRE(n1 !=
nullptr);
522 auto n2 = std::get_if<None>(&context.
get(1));
523 REQUIRE(n2 !=
nullptr);
524 auto n3 = std::get_if<None>(&context.
get(10));
525 REQUIRE(n3 !=
nullptr);
535 auto empty_bindings = [](std::runtime_error
const& ex) ->
bool {
536 REQUIRE(std::string(ex.what()) ==
"Parse error: empty binding string");
539 auto missing_origin = [](std::runtime_error
const& ex) ->
bool {
540 REQUIRE(std::string(ex.what()) ==
"Parse error: origin needs to be between 1 and 4 char long");
543 auto missing_description = [](std::runtime_error
const& ex) ->
bool {
544 REQUIRE(std::string(ex.what()) ==
"Parse error: description needs to be between 1 and 16 char long");
547 auto missing_subspec = [](std::runtime_error
const& ex) ->
bool {
548 REQUIRE(std::string(ex.what()) ==
"Parse error: Expected a number");
551 auto missing_timemodulo = [](std::runtime_error
const& ex) ->
bool {
552 REQUIRE(std::string(ex.what()) ==
"Parse error: Expected a number");
555 auto trailing_semicolon = [](std::runtime_error
const& ex) ->
bool {
556 REQUIRE(std::string(ex.what()) ==
"Parse error: Remove trailing ;");
560 auto missing_value = [](std::runtime_error
const& ex) ->
bool {
561 REQUIRE(std::string(ex.what()) ==
"Parse error: value needs to be between 1 and 1000 char long");
564 auto missing_key = [](std::runtime_error
const& ex) ->
bool {
565 REQUIRE(std::string(ex.what()) ==
"Parse error: missing value for attribute key");
591 REQUIRE(result0.size() == 1);
593 DataDescriptorMatcher::Op::And,
595 std::make_unique<DataDescriptorMatcher>(
596 DataDescriptorMatcher::Op::And,
598 std::make_unique<DataDescriptorMatcher>(
599 DataDescriptorMatcher::Op::And,
601 std::make_unique<DataDescriptorMatcher>(DataDescriptorMatcher::Op::Just,
603 auto matcher = std::get_if<DataDescriptorMatcher>(&result0[0].matcher);
604 REQUIRE(matcher !=
nullptr);
605 REQUIRE(expectedMatcher00 == *matcher);
606 std::ostringstream ss0;
608 std::ostringstream expectedSS00;
609 expectedSS00 << expectedMatcher00;
610 REQUIRE(ss0.str() ==
"(and origin:TST (and description:A1 (and subSpec:77 (just startTime:$0 ))))");
611 REQUIRE(expectedSS00.str() ==
"(and origin:TST (and description:A1 (and subSpec:77 (just startTime:$0 ))))");
612 REQUIRE(ss0.str() == expectedSS00.str());
629 REQUIRE(result1.size() == 2);
631 std::ostringstream ops;
632 ops << DataDescriptorMatcher::Op::And
633 << DataDescriptorMatcher::Op::Or
634 << DataDescriptorMatcher::Op::Xor
635 << DataDescriptorMatcher::Op::Just;
636 REQUIRE(ops.str() ==
"andorxorjust");
640 REQUIRE(result2[0].lifetime == Lifetime::Condition);
646 REQUIRE(result3[0].metadata.size() == 2);
649 REQUIRE(result4.size() == 1);
650 result4[0].lifetime = Lifetime::Condition;
651 REQUIRE(result4[0].metadata.size() == 3);
652 REQUIRE(result4[0].metadata[0].
name ==
"lifetime");
653 REQUIRE(result4[0].metadata[0].defaultValue.get<std::string>() ==
"condition");
654 REQUIRE(result4[0].metadata[1].
name ==
"ccdb-path");
655 REQUIRE(result4[0].metadata[1].defaultValue.get<std::string>() ==
"GLO/Config/GRPECS");
656 REQUIRE(result4[0].metadata[2].
name ==
"key3");
657 REQUIRE(result4[0].metadata[2].defaultValue.get<std::string>() ==
"value3");
663 REQUIRE(result5.size() == 1);
664 REQUIRE(result5[0].lifetime == Lifetime::Sporadic);
665 REQUIRE(result5[0].metadata.size() == 3);
666 REQUIRE(result5[0].metadata[0].
name ==
"lifetime");
667 REQUIRE(result5[0].metadata[0].defaultValue.get<std::string>() ==
"sporadic");
668 REQUIRE(result5[0].metadata[1].
name ==
"ccdb-path");
669 REQUIRE(result5[0].metadata[1].defaultValue.get<std::string>() ==
"GLO/Config/GRPECS");
670 REQUIRE(result5[0].metadata[2].
name ==
"key3");
671 REQUIRE(result5[0].metadata[2].defaultValue.get<std::string>() ==
"value3");
677 REQUIRE(result0.size() == 1);
678 REQUIRE(result0[0].lifetime == Lifetime::Timeframe);
680 REQUIRE(result1.size() == 1);
681 REQUIRE(result1[0].lifetime == Lifetime::Sporadic);
683 REQUIRE(result2.size() == 1);
684 REQUIRE(result2[0].lifetime == Lifetime::Condition);
687 REQUIRE(result3.size() == 1);
688 REQUIRE(result3[0].lifetime == Lifetime::Timeframe);
690 REQUIRE(result4.size() == 1);
691 REQUIRE(result4[0].lifetime == Lifetime::Sporadic);
693 REQUIRE(result5.size() == 1);
695 REQUIRE(concrete.origin.as<std::string>() ==
"TRD");
696 REQUIRE(concrete.description.as<std::string>() ==
"NOISEMAP");
697 REQUIRE(result5[0].lifetime == Lifetime::Condition);
void put(ContextUpdate &&update)
ContextElement::Value const & get(size_t pos) const
A typesafe reference to an element of the context.