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

View File

@@ -45,24 +45,22 @@ TEST_CASE("StatusVector_Plot","[StatusVector]") {
status_vector.AddElement(2543, 44);
status_vector.AddElement(2600, 41);
JFJochProtoBuf::Plot plot_out;
status_vector.GetPlot(plot_out, 1000);
REQUIRE(plot_out.x_size() == 3);
REQUIRE(plot_out.y_size() == 3);
REQUIRE(plot_out.x(0) == Approx(500));
REQUIRE(plot_out.y(0) == Approx(11));
REQUIRE(plot_out.x(2) == Approx(2500));
REQUIRE(plot_out.y(2) == Approx((45 + 44 + 41) / 3.0));
Plot plot_out = status_vector.GetPlot(1000);
REQUIRE(plot_out.x.size() == 3);
REQUIRE(plot_out.y.size() == 3);
REQUIRE(plot_out.x[0] == Approx(500));
REQUIRE(plot_out.y[0] == Approx(11));
REQUIRE(plot_out.x[2] == Approx(2500));
REQUIRE(plot_out.y[2] == Approx((45 + 44 + 41) / 3.0));
}
TEST_CASE("StatusVector_Plot_OneBin","[StatusVector]") {
StatusVector<uint64_t> status_vector;
status_vector.AddElement(5, 11);
JFJochProtoBuf::Plot plot_out;
status_vector.GetPlot(plot_out, 1000);
REQUIRE(plot_out.x_size() == 1);
REQUIRE(plot_out.y_size() == 1);
REQUIRE(plot_out.x(0) == Approx(2.5));
REQUIRE(plot_out.y(0) == Approx(11));
auto plot_out = status_vector.GetPlot(1000);
REQUIRE(plot_out.x.size() == 1);
REQUIRE(plot_out.y.size() == 1);
REQUIRE(plot_out.x[0] == Approx(2.5));
REQUIRE(plot_out.y[0] == Approx(11));
}