@@ -460,3 +460,33 @@ TEST_CASE("optionalConcreteDataMatcherFrom")
460460 REQUIRE (DataSpecUtils::asOptionalConcreteDataMatcher (ConcreteDataMatcher{" ITS" , " RAWDATA" , 0 }) == ConcreteDataMatcher{" ITS" , " RAWDATA" , 0 });
461461 REQUIRE (DataSpecUtils::asOptionalConcreteDataMatcher (ConcreteDataTypeMatcher{" ITS" , " RAWDATA" }) == std::nullopt );
462462}
463+
464+ // Testcase for DataSpecUtils::updateOutputList
465+ TEST_CASE (" UpdateOutputList" )
466+ {
467+ // Empty vector of output specs should simply add the new spec
468+ std::vector<OutputSpec> outputSpecs;
469+ DataSpecUtils::updateOutputList (outputSpecs, {" TST" , " DATA1" , 0 });
470+ CHECK (outputSpecs.size () == 1 );
471+
472+ // Adding the same spec again should not change the size
473+ DataSpecUtils::updateOutputList (outputSpecs, {" TST" , " DATA1" , 0 });
474+ CHECK (outputSpecs.size () == 1 );
475+
476+ // Adding a different spec should increase the size
477+ DataSpecUtils::updateOutputList (outputSpecs, {" TST" , " DATA2" , 0 });
478+ CHECK (outputSpecs.size () == 2 );
479+
480+ // Adding again the same spec again should not change the size
481+ DataSpecUtils::updateOutputList (outputSpecs, {" TST" , " DATA1" , 0 });
482+ CHECK (outputSpecs.size () == 2 );
483+ // Check with something real..
484+ ConcreteDataMatcher dstf{" FLP" , " DISTSUBTIMEFRAME" , 0xccdb };
485+ DataSpecUtils::updateOutputList (outputSpecs, OutputSpec{{" ccdb-diststf" }, dstf, Lifetime::Timeframe});
486+ CHECK (outputSpecs.size () == 3 );
487+ DataSpecUtils::updateOutputList (outputSpecs, OutputSpec{{" ccdb-diststf" }, dstf, Lifetime::Timeframe});
488+ CHECK (outputSpecs.size () == 3 );
489+ // Label does not matter
490+ DataSpecUtils::updateOutputList (outputSpecs, OutputSpec{{" ccdb2-diststf" }, dstf, Lifetime::Timeframe});
491+ CHECK (outputSpecs.size () == 3 );
492+ }
0 commit comments