Skip to content

Commit 8746fc8

Browse files
Gabriele Gaetano Fronzématthiasrichter
authored andcommitted
Using Cluster2D instead of int in test_BoostSerializedProcessing
To comply with the dropped trivial type support
1 parent 62d4fc9 commit 8746fc8

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

Framework/Core/test/test_BoostSerializedProcessing.cxx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "Framework/CallbackService.h"
1818
#include "FairMQLogger.h"
1919
#include "Framework/SerializationMethods.h"
20+
#include "DataFormatsMID/Cluster2D.h"
2021

2122
using namespace o2::framework;
2223
using DataHeader = o2::header::DataHeader;
@@ -33,11 +34,14 @@ WorkflowSpec defineDataProcessing(ConfigContext const&)
3334
OutputSpec{ { "make" }, "TES", "BOOST" }, //
3435
},
3536
AlgorithmSpec{ [](ProcessingContext& ctx) {
36-
auto& out1 = ctx.outputs().make<BoostSerialized<std::array<int, 6>>>({ "TES", "BOOST" });
37+
auto& out1 = ctx.outputs().make<BoostSerialized<std::vector<o2::mid::Cluster2D>>>({ "TES", "BOOST" });
3738
// auto& out1 = ctx.outputs().make_boost<std::array<int,6>>({ "TES", "BOOST" });
3839
// auto& out1 = ctx.outputs().make<BoostSerialized<std::array<int,6>>>({ "TES", "BOOST" });
3940
// auto& out1 = ctx.outputs().make<std::array<int,6>>({ "TES", "BOOST" });
40-
out1 = { 1, 2, 3, 4, 5, 6 };
41+
for (size_t i = 0; i < 17; i++) {
42+
float iFloat = (float)i;
43+
out1.emplace_back(o2::mid::Cluster2D{ (uint8_t)i, 0.3f * iFloat, 0.5f * iFloat, 0.7f / iFloat, 0.9f / iFloat });
44+
}
4145
} } //
4246
}, //
4347
DataProcessorSpec{
@@ -50,16 +54,21 @@ WorkflowSpec defineDataProcessing(ConfigContext const&)
5054
[](ProcessingContext& ctx) {
5155
LOG(INFO) << "Buffer ready to receive";
5256

53-
auto in = ctx.inputs().get<BoostSerialized<std::array<int, 6>>>("make");
54-
std::array<int, 6> check = { 1, 2, 3, 4, 5, 6 };
55-
int cnt = 0;
56-
for (const auto& it : in) {
57-
if (it != check[cnt]) {
58-
LOG(ERROR) << "Expecting " << check[cnt] << ", found `" << it << "'";
59-
} else {
60-
LOG(INFO) << "Position " << cnt << " OK";
61-
}
62-
cnt++;
57+
auto in = ctx.inputs().get<BoostSerialized<std::vector<o2::mid::Cluster2D>>>("make");
58+
std::vector<o2::mid::Cluster2D> check;
59+
for (size_t i = 0; i < 17; i++) {
60+
float iFloat = (float)i;
61+
check.emplace_back(o2::mid::Cluster2D{ (uint8_t)i, 0.3f * iFloat, 0.5f * iFloat, 0.7f / iFloat, 0.9f / iFloat });
62+
}
63+
64+
size_t i = 0;
65+
for (auto const& test : in) {
66+
assert((test.deId == check[i].deId)); // deId Wrong
67+
assert((test.xCoor == check[i].xCoor)); // xCoor Wrong
68+
assert((test.yCoor == check[i].yCoor)); // yCoor Wrong
69+
assert((test.sigmaX2 == check[i].sigmaX2)); // sigmaX2 Wrong
70+
assert((test.sigmaY2 == check[i].sigmaY2)); // sigmaY2 Wrong
71+
i++;
6372
}
6473
ctx.services().get<ControlService>().readyToQuit(true);
6574
} //

0 commit comments

Comments
 (0)