11#define BOOST_TEST_MODULE Test Framework DataSamplingCondition
12#define BOOST_TEST_MAIN
13#define BOOST_TEST_DYN_LINK
16#include <boost/test/unit_test.hpp>
17#include <boost/property_tree/ptree.hpp>
32 BOOST_REQUIRE(conditionRandom);
34 boost::property_tree::ptree config;
35 config.put(
"fraction",
"0.5");
36 config.put(
"seed",
"943753948");
37 conditionRandom->configure(config);
42 std::vector<bool> correctDecision{
43 true,
false,
true,
false,
true,
false,
false,
true,
false,
false,
true,
true,
false,
false,
true,
false,
false,
44 true,
false,
false,
true,
true,
true,
false,
false,
false,
true,
false,
true,
true,
true,
false,
false,
true,
45 false,
false,
false,
false,
false,
false,
true,
false,
false,
true,
false,
false,
true,
false,
false};
49 DataRef dr{
nullptr,
reinterpret_cast<const char*
>(headerStack.data()),
nullptr};
56 std::vector<std::pair<DataProcessingHeader::StartTime, bool>> correctDecision{
67 for (
const auto&
check : correctDecision) {
70 DataRef dr{
nullptr,
reinterpret_cast<const char*
>(headerStack.data()),
nullptr};
79 BOOST_REQUIRE(conditionPayloadSize);
81 boost::property_tree::ptree config;
82 config.put(
"upperLimit", 500);
83 config.put(
"lowerLimit", 30);
84 conditionPayloadSize->configure(config);
86 std::vector<std::pair<size_t, bool>> testCases{
94 for (
const auto& t : testCases) {
98 DataRef dr{
nullptr,
reinterpret_cast<const char*
>(headerStack.data()),
nullptr};
105 BOOST_REQUIRE(conditionNConsecutive);
107 boost::property_tree::ptree config;
108 config.put(
"samplesNumber", 3);
109 config.put(
"cycleSize", 10);
110 conditionNConsecutive->configure(config);
112 std::vector<std::pair<size_t, bool>> testCases{
119 {9999999999999,
false},
120 {10000000000000,
true},
121 {10000000000001,
true},
122 {10000000000002,
true},
123 {10000000000003,
false}};
125 for (
const auto& t : testCases) {
128 DataRef dr{
nullptr,
reinterpret_cast<const char*
>(headerStack.data()),
nullptr};
A definition of DataSamplingConditionFactory.
static std::unique_ptr< DataSamplingCondition > create(std::string name)
Creates instance of DataSamplingCondition child, given the name.
A DataSamplingCondition which approves n consecutive samples in defined cycle. It assumes that timesl...
A DataSamplingCondition which makes decisions based on payload size.
A DataSamplingCondition which makes decisions randomly, but with determinism.
Defining PrimaryVertex explicitly as messageable.
void check(const std::vector< std::string > &arguments, const std::vector< ConfigParamSpec > &workflowOptions, const std::vector< DeviceSpec > &deviceSpecs, CheckMatrix &matrix)
A header which contains some meta-data generated by Data Sampling.
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())