v1.0.0-rc.40

This commit is contained in:
2025-05-28 18:49:27 +02:00
parent aaae74e70b
commit 53c90ee5d8
340 changed files with 9583 additions and 5919 deletions

View File

@@ -14,35 +14,107 @@ TEST_CASE("StatusVector_GetMeanPerBin","[StatusVector]") {
MultiLinePlotStruct plot;
plot = status_vector.GetMeanPerBin(1000);
SECTION("Binning 1000") {
plot = status_vector.GetMeanPerBin(1000, 0.0, 1.0);
REQUIRE(plot.x.size() == 2);
REQUIRE(plot.y.size() == 2);
CHECK(plot.x[0] == Catch::Approx(500));
CHECK(plot.x[1] == Catch::Approx(2500));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx((45 + 44 + 41) / 3.0));
REQUIRE(plot.x.size() == 2);
REQUIRE(plot.y.size() == 2);
CHECK(plot.x[0] == Catch::Approx(500));
CHECK(plot.x[1] == Catch::Approx(2500));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx((45 + 44 + 41) / 3.0));
}
plot = status_vector.GetMeanPerBin(500);
SECTION("Binning 500") {
plot = status_vector.GetMeanPerBin(500, 0.0, 1.0);
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
CHECK(plot.x[0] == Catch::Approx(250));
CHECK(plot.x[1] == Catch::Approx(2250));
CHECK(plot.x[2] == Catch::Approx(2750));
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
CHECK(plot.x[0] == Catch::Approx(250));
CHECK(plot.x[1] == Catch::Approx(2250));
CHECK(plot.x[2] == Catch::Approx(2750));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx((44 + 41) / 2.0));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx((44 + 41) / 2.0));
}
SECTION("Binning 1") {
plot = status_vector.GetMeanPerBin(1, 0.0, 1.0);
plot = status_vector.GetMeanPerBin(1);
REQUIRE(plot.x.size() == 4);
REQUIRE(plot.y.size() == 4);
CHECK(plot.x[0] == Catch::Approx(5));
CHECK(plot.x[1] == Catch::Approx(2000));
CHECK(plot.x[2] == Catch::Approx(2543));
CHECK(plot.x[3] == Catch::Approx(2600));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx(44));
CHECK(plot.y[3] == Catch::Approx(41));
}
}
TEST_CASE("StatusVector_GetMeanPerBin_Start_Incr","[StatusVector]") {
StatusVector<uint64_t> status_vector;
status_vector.AddElement(5, 11);
status_vector.AddElement(2000, 45);
status_vector.AddElement(2543, 44);
status_vector.AddElement(2600, 41);
MultiLinePlotStruct plot;
float start = 545.0f;
float incr = 2.5f;
SECTION("Binning") {
plot = status_vector.GetMeanPerBin(1000, start, incr);
REQUIRE(plot.x.size() == 2);
REQUIRE(plot.y.size() == 2);
CHECK(plot.x[0] == Catch::Approx(start + 500 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 2500 * incr));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx((45 + 44 + 41) / 3.0));
}
SECTION("No binning") {
plot = status_vector.GetMeanPerBin(1, start, incr);
REQUIRE(plot.x.size() == 4);
REQUIRE(plot.y.size() == 4);
CHECK(plot.x[0] == Catch::Approx(start + 5 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 2000 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2543 * incr));
CHECK(plot.x[3] == Catch::Approx(start + 2600 * incr));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
CHECK(plot.y[2] == Catch::Approx(44));
CHECK(plot.y[3] == Catch::Approx(41));
}
}
TEST_CASE("StatusVector_GetMaxPerBin_Start_Incr","[StatusVector]") {
StatusVector<uint64_t> status_vector;
status_vector.AddElement(5, 11);
status_vector.AddElement(2000, 45);
status_vector.AddElement(2543, 44);
status_vector.AddElement(2600, 41);
MultiLinePlotStruct plot;
float start = 545.0f;
float incr = 2.5f;
plot = status_vector.GetMaxPerBin(1, start, incr);
REQUIRE(plot.x.size() == 4);
REQUIRE(plot.y.size() == 4);
CHECK(plot.x[0] == Catch::Approx(5));
CHECK(plot.x[1] == Catch::Approx(2000));
CHECK(plot.x[2] == Catch::Approx(2543));
CHECK(plot.x[3] == Catch::Approx(2600));
CHECK(plot.x[0] == Catch::Approx(start + 5 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 2000 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2543 * incr));
CHECK(plot.x[3] == Catch::Approx(start + 2600 * incr));
CHECK(plot.y[0] == Catch::Approx(11));
CHECK(plot.y[1] == Catch::Approx(45));
@@ -50,6 +122,54 @@ TEST_CASE("StatusVector_GetMeanPerBin","[StatusVector]") {
CHECK(plot.y[3] == Catch::Approx(41));
}
TEST_CASE("StatusVector_GetMeanPerBin_Fill","[StatusVector]") {
StatusVector<uint64_t> status_vector;
status_vector.AddElement(5, 11);
status_vector.AddElement(2000, 45);
status_vector.AddElement(2543, 44);
status_vector.AddElement(2600, 41);
MultiLinePlotStruct plot;
float start = 545.0f;
float incr = 2.5f;
float fill = -345.0f;
SECTION("Binning") {
plot = status_vector.GetMeanPerBin(1000, start, incr, fill);
REQUIRE(plot.x.size() == 3);
REQUIRE(plot.y.size() == 3);
CHECK(plot.x[0] == Catch::Approx(start + 500 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 1500 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2500 * incr));
CHECK(plot.y[0] == Catch::Approx(11.0));
CHECK(plot.y[1] == Catch::Approx(fill));
CHECK(plot.y[2] == Catch::Approx((45 + 44 + 41) / 3.0f));
}
SECTION("No Binning") {
plot = status_vector.GetMeanPerBin(1, start, incr, fill);
REQUIRE(plot.x.size() == 2601);
REQUIRE(plot.y.size() == 2601);
CHECK(plot.x[0] == Catch::Approx(start + 0 * incr));
CHECK(plot.x[1] == Catch::Approx(start + 1 * incr));
CHECK(plot.x[2] == Catch::Approx(start + 2 * incr));
CHECK(plot.x[2600] == Catch::Approx(start + 2600 * incr));
CHECK(plot.y[0] == Catch::Approx(fill));
CHECK(plot.y[1] == Catch::Approx(fill));
CHECK(plot.y[2] == Catch::Approx(fill));
CHECK(plot.y[5] == Catch::Approx(11));
CHECK(plot.y[2000] == Catch::Approx(45));
CHECK(plot.y[2543] == Catch::Approx(44));
CHECK(plot.y[2599] == Catch::Approx(fill));
CHECK(plot.y[2600] == Catch::Approx(41));
}
}
TEST_CASE("StatusVector_Mean","[StatusVector]") {
StatusVector<float> status_vector;
status_vector.AddElement(5, 0.045f);
@@ -77,7 +197,7 @@ TEST_CASE("StatusVector_GetMaxPerBin","[StatusVector]") {
status_vector.AddElement(2543, 44);
status_vector.AddElement(2600, 41);
auto status_out = status_vector.GetMaxPerBin(1000);
auto status_out = status_vector.GetMaxPerBin(1000, 0.0, 1.0);
REQUIRE(status_out.x.size() == 2);
REQUIRE(status_out.y.size() == 2);
@@ -86,7 +206,7 @@ TEST_CASE("StatusVector_GetMaxPerBin","[StatusVector]") {
REQUIRE(status_out.y[0] == 11);
REQUIRE(status_out.y[1] == 45);
status_out = status_vector.GetMaxPerBin(500);
status_out = status_vector.GetMaxPerBin(500, 0.0, 1.0);
REQUIRE(status_out.x.size() == 3);
REQUIRE(status_out.y.size() == 3);
@@ -94,7 +214,7 @@ TEST_CASE("StatusVector_GetMaxPerBin","[StatusVector]") {
REQUIRE(status_out.y[1] == 45);
REQUIRE(status_out.y[2] == 44);
status_out = status_vector.GetMaxPerBin(1);
status_out = status_vector.GetMaxPerBin(1, 0.0, 1.0);
REQUIRE(status_out.x.size() == 4);
REQUIRE(status_out.y.size() == 4);
REQUIRE(status_out.x[0] == 5);
@@ -130,26 +250,26 @@ TEST_CASE("StatusVector_Plot_OneBin","[StatusVector]") {
status_vector.AddElement(5, 11);
status_vector.AddElement(7, 12);
auto plot_out = status_vector.GetMeanPlot(1000);
REQUIRE(plot_out.size() == 1);
REQUIRE(plot_out[0].x.size() == 2);
REQUIRE(plot_out[0].y.size() == 2);
REQUIRE(plot_out[0].x[0] == Catch::Approx(5));
REQUIRE(plot_out[0].y[0] == Catch::Approx(11));
REQUIRE(plot_out[0].x[1] == Catch::Approx(7));
REQUIRE(plot_out[0].y[1] == Catch::Approx(12));
auto plot_out = status_vector.GetMeanPlot(1000, 0.0, 1.0);
REQUIRE(plot_out.GetPlots().size() == 1);
REQUIRE(plot_out.GetPlots()[0].x.size() == 2);
REQUIRE(plot_out.GetPlots()[0].y.size() == 2);
REQUIRE(plot_out.GetPlots()[0].x[0] == Catch::Approx(5));
REQUIRE(plot_out.GetPlots()[0].y[0] == Catch::Approx(11));
REQUIRE(plot_out.GetPlots()[0].x[1] == Catch::Approx(7));
REQUIRE(plot_out.GetPlots()[0].y[1] == Catch::Approx(12));
}
TEST_CASE("StatusVector_Plot_NoBinning","[StatusVector]") {
StatusVector<uint64_t> status_vector;
status_vector.AddElement(5, 11);
auto plot_out = status_vector.GetMaxPlot(1);
REQUIRE(plot_out.size() == 1);
REQUIRE(plot_out[0].x.size() == 1);
REQUIRE(plot_out[0].y.size() == 1);
REQUIRE(plot_out[0].x[0] == Catch::Approx(5));
REQUIRE(plot_out[0].y[0] == Catch::Approx(11));
auto plot_out = status_vector.GetMaxPlot(1, 0.0, 1.0);
REQUIRE(plot_out.GetPlots().size() == 1);
REQUIRE(plot_out.GetPlots()[0].x.size() == 1);
REQUIRE(plot_out.GetPlots()[0].y.size() == 1);
REQUIRE(plot_out.GetPlots()[0].x[0] == Catch::Approx(5));
REQUIRE(plot_out.GetPlots()[0].y[0] == Catch::Approx(11));
}
TEST_CASE("StatusMultiVector","[StatusMultiVector]") {
@@ -159,19 +279,19 @@ TEST_CASE("StatusMultiVector","[StatusMultiVector]") {
status_vector.AddElement("plot2", 0, 5);
status_vector.AddElement("plot2", 1, 4);
auto ret = status_vector.GetMeanPlot(1);
REQUIRE(ret.size() == 2);
REQUIRE(ret[0].title == "plot1");
REQUIRE(ret[0].x.size() == 2);
REQUIRE(ret[0].y.size() == 2);
REQUIRE(ret[0].x[0] == 0.0f);
REQUIRE(ret[0].y[1] == 3.0f);
auto ret = status_vector.GetMeanPlot(1, 3.0, 5.0);
REQUIRE(ret.GetPlots().size() == 2);
REQUIRE(ret.GetPlots()[0].title == "plot1");
REQUIRE(ret.GetPlots()[0].x.size() == 2);
REQUIRE(ret.GetPlots()[0].y.size() == 2);
REQUIRE(ret.GetPlots()[0].x[0] == 3.0 + 5.0 * 0.0f);
REQUIRE(ret.GetPlots()[0].y[1] == 3.0f);
REQUIRE(ret[1].title == "plot2");
REQUIRE(ret[1].x.size() == 2);
REQUIRE(ret[1].y.size() == 2);
REQUIRE(ret[1].x[1] == 1.0f);
REQUIRE(ret[1].y[1] == 4.0f);
REQUIRE(ret.GetPlots()[1].title == "plot2");
REQUIRE(ret.GetPlots()[1].x.size() == 2);
REQUIRE(ret.GetPlots()[1].y.size() == 2);
REQUIRE(ret.GetPlots()[1].x[1] == 3.0 + 5.0 * 1.0f);
REQUIRE(ret.GetPlots()[1].y[1] == 4.0f);
}
TEST_CASE("StatusVector_Clear","[StatusVector]") {
@@ -187,10 +307,10 @@ TEST_CASE("StatusVector_Clear","[StatusVector]") {
status_vector.AddElement(80, 100);
REQUIRE(status_vector.Mean() == 150);
auto plot = status_vector.GetMeanPlot(1);
auto plot = status_vector.GetMeanPlot(1, 0.0, 1.0);
REQUIRE(plot.size() == 1);
REQUIRE(plot[0].x.size() == 2);
REQUIRE(plot[0].x[0] == 50);
REQUIRE(plot[0].x[1] == 80);
REQUIRE(plot.GetPlots().size() == 1);
REQUIRE(plot.GetPlots()[0].x.size() == 2);
REQUIRE(plot.GetPlots()[0].x[0] == 50);
REQUIRE(plot.GetPlots()[0].x[1] == 80);
}