JFJochReceiver: Plot is C++ struct

This commit is contained in:
2023-11-10 21:22:42 +01:00
parent 04c251d16a
commit d83b8d465d
13 changed files with 165 additions and 87 deletions
+10 -12
View File
@@ -79,14 +79,13 @@ TEST_CASE("RadialIntegrationProfile","[RadialIntegration]") {
std::vector<int64_t> sum_wr(mapping.GetBinNumber() - 1);
REQUIRE_THROWS(profile.Add(sum_wr, count));
JFJochProtoBuf::Plot plot;
profile.GetPlot(plot);
Plot plot = profile.GetPlot();
REQUIRE(plot.x_size() == mapping.GetBinNumber());
REQUIRE(plot.y_size() == mapping.GetBinNumber());
REQUIRE(plot.x.size() == mapping.GetBinNumber());
REQUIRE(plot.y.size() == mapping.GetBinNumber());
for (int i = 0; i < mapping.GetBinNumber(); i++) {
REQUIRE(plot.x(i) == Approx(mapping.GetBinToQ()[i]));
REQUIRE(plot.y(i) == Approx(i * 4));
REQUIRE(plot.x[i] == Approx(mapping.GetBinToQ()[i]));
REQUIRE(plot.y[i] == Approx(i * 4));
}
}
@@ -109,14 +108,13 @@ TEST_CASE("RadialIntegrationProfile_operatorAdd","[RadialIntegration]") {
REQUIRE_NOTHROW(profile0.Add(sum, count));
REQUIRE_NOTHROW(profile1 += profile0);
JFJochProtoBuf::Plot plot;
profile1.GetPlot(plot);
auto plot = profile1.GetPlot();
REQUIRE(plot.x_size() == mapping.GetBinNumber());
REQUIRE(plot.y_size() == mapping.GetBinNumber());
REQUIRE(plot.x.size() == mapping.GetBinNumber());
REQUIRE(plot.y.size() == mapping.GetBinNumber());
for (int i = 0; i < mapping.GetBinNumber(); i++) {
REQUIRE(plot.x(i) == Approx(mapping.GetBinToQ()[i]));
REQUIRE(plot.y(i) == Approx(i * 4));
REQUIRE(plot.x[i] == Approx(mapping.GetBinToQ()[i]));
REQUIRE(plot.y[i] == Approx(i * 4));
}
}