diff --git a/CMakeLists.txt b/CMakeLists.txt index bb482b04..60611b27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,13 @@ FetchContent_Declare( GIT_TAG bae261433241ff2f458350e26ab026f00f01c427 ) -FetchContent_MakeAvailable(pistache_http zstd sls_detector_package) +FetchContent_Declare( + catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2 + GIT_TAG 4e8d92b +) + +FetchContent_MakeAvailable(pistache_http zstd sls_detector_package catch2) ADD_SUBDIRECTORY(jungfrau) ADD_SUBDIRECTORY(compression) diff --git a/tests/AcquisitionCountersTest.cpp b/tests/AcquisitionCountersTest.cpp index d9c2937f..d6ccb15f 100644 --- a/tests/AcquisitionCountersTest.cpp +++ b/tests/AcquisitionCountersTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../acquisition_device/AcquisitionCounters.h" TEST_CASE("AcquisitionCountersTest","[AcquisitionDeviceCounters]") { diff --git a/tests/AzimuthalIntegrationTest.cpp b/tests/AzimuthalIntegrationTest.cpp index 14e306b8..e0cbd162 100644 --- a/tests/AzimuthalIntegrationTest.cpp +++ b/tests/AzimuthalIntegrationTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../image_analysis/AzimuthalIntegrationProfile.h" @@ -38,10 +38,10 @@ TEST_CASE("AzimuthalIntegrationMapping_GetBinToQ","[AzimuthalIntegration]") { AzimuthalIntegrationMapping mapping(x); auto bin_to_q = mapping.GetBinToQ(); - REQUIRE(bin_to_q[0] == Approx(0.15)); - REQUIRE(bin_to_q[1] == Approx(0.25)); - REQUIRE(bin_to_q[15] == Approx(1.65)); - REQUIRE(bin_to_q[38] == Approx(3.95)); + REQUIRE(bin_to_q[0] == Catch::Approx(0.15)); + REQUIRE(bin_to_q[1] == Catch::Approx(0.25)); + REQUIRE(bin_to_q[15] == Catch::Approx(1.65)); + REQUIRE(bin_to_q[38] == Catch::Approx(3.95)); } TEST_CASE("AzimuthalIntegrationMapping_QToBin","[AzimuthalIntegration]") { @@ -53,8 +53,8 @@ TEST_CASE("AzimuthalIntegrationMapping_QToBin","[AzimuthalIntegration]") { REQUIRE(mapping.QToBin(0.0) == 0); REQUIRE(std::floor(mapping.QToBin(0.200001)) == 1); - REQUIRE(mapping.QToBin(0.6) == Approx(5)); - REQUIRE(mapping.QToBin(50.0) == Approx(38)); + REQUIRE(mapping.QToBin(0.6) == Catch::Approx(5)); + REQUIRE(mapping.QToBin(50.0) == Catch::Approx(38)); } TEST_CASE("AzimuthalIntegrationProfile","[AzimuthalIntegration]") { @@ -85,8 +85,8 @@ TEST_CASE("AzimuthalIntegrationProfile","[AzimuthalIntegration]") { REQUIRE(plot[0].x.size() == mapping.GetBinNumber()); REQUIRE(plot[0].y.size() == mapping.GetBinNumber()); for (int i = 0; i < mapping.GetBinNumber(); i++) { - REQUIRE(plot[0].x[i] == Approx(mapping.GetBinToQ()[i])); - REQUIRE(plot[0].y[i] == Approx(i * 4)); + REQUIRE(plot[0].x[i] == Catch::Approx(mapping.GetBinToQ()[i])); + REQUIRE(plot[0].y[i] == Catch::Approx(i * 4)); } } @@ -115,8 +115,8 @@ TEST_CASE("AzimuthalIntegrationProfile_operatorAdd","[AzimuthalIntegration]") { REQUIRE(plot[0].x.size() == mapping.GetBinNumber()); REQUIRE(plot[0].y.size() == mapping.GetBinNumber()); for (int i = 0; i < mapping.GetBinNumber(); i++) { - REQUIRE(plot[0].x[i] == Approx(mapping.GetBinToQ()[i])); - REQUIRE(plot[0].y[i] == Approx(i * 4)); + REQUIRE(plot[0].x[i] == Catch::Approx(mapping.GetBinToQ()[i])); + REQUIRE(plot[0].y[i] == Catch::Approx(i * 4)); } } @@ -138,6 +138,6 @@ TEST_CASE("AzimuthalIntegrationProfile_GetMeanValueOfBins","[AzimuthalIntegratio } REQUIRE_NOTHROW(profile.Add(sum, count)); - REQUIRE(profile.GetMeanValueOfBins(0,2) == Approx ((sum[0] + sum[1] + sum[2]) / double(count[0] + count[1] + count[2]))); - REQUIRE(profile.GetMeanValueOfBins(5,7) == Approx ((sum[5] + sum[6] + sum[7]) / double (count[5] + count[6] + count[7]))); + REQUIRE(profile.GetMeanValueOfBins(0,2) == Catch::Approx((sum[0] + sum[1] + sum[2]) / double(count[0] + count[1] + count[2]))); + REQUIRE(profile.GetMeanValueOfBins(5,7) == Catch::Approx((sum[5] + sum[6] + sum[7]) / double (count[5] + count[6] + count[7]))); } diff --git a/tests/CBORTest.cpp b/tests/CBORTest.cpp index 2914bd33..d2fc925a 100644 --- a/tests/CBORTest.cpp +++ b/tests/CBORTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../frame_serialize/CBORStream2Serializer.h" #include "../frame_serialize/CBORStream2Deserializer.h" @@ -76,22 +76,22 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") { StartMessage &output_message = *deserialized->start_message; CHECK(output_message.images_per_file == message.images_per_file); - CHECK(output_message.detector_distance == Approx(message.detector_distance)); - CHECK(output_message.beam_center_x == Approx(message.beam_center_x)); - CHECK(output_message.beam_center_y == Approx(message.beam_center_y)); + CHECK(output_message.detector_distance == Catch::Approx(message.detector_distance)); + CHECK(output_message.beam_center_x == Catch::Approx(message.beam_center_x)); + CHECK(output_message.beam_center_y == Catch::Approx(message.beam_center_y)); CHECK(output_message.number_of_images == message.number_of_images); CHECK(output_message.image_size_x == message.image_size_x); CHECK(output_message.image_size_y == message.image_size_y); CHECK(output_message.pixel_bit_depth == message.pixel_bit_depth); - CHECK(output_message.incident_energy == Approx(message.incident_energy)); - CHECK(output_message.incident_wavelength == Approx(message.incident_wavelength)); - CHECK(output_message.frame_time == Approx(message.frame_time)); - CHECK(output_message.count_time == Approx(message.count_time)); + CHECK(output_message.incident_energy == Catch::Approx(message.incident_energy)); + CHECK(output_message.incident_wavelength == Catch::Approx(message.incident_wavelength)); + CHECK(output_message.frame_time == Catch::Approx(message.frame_time)); + CHECK(output_message.count_time == Catch::Approx(message.count_time)); CHECK(output_message.saturation_value == message.saturation_value); CHECK(output_message.error_value == message.error_value); - CHECK(output_message.pixel_size_x == Approx(message.pixel_size_x)); - CHECK(output_message.pixel_size_y == Approx(message.pixel_size_y)); - CHECK(output_message.sensor_thickness == Approx(message.sensor_thickness)); + CHECK(output_message.pixel_size_x == Catch::Approx(message.pixel_size_x)); + CHECK(output_message.pixel_size_y == Catch::Approx(message.pixel_size_y)); + CHECK(output_message.sensor_thickness == Catch::Approx(message.sensor_thickness)); CHECK(output_message.sensor_material == message.sensor_material); CHECK(output_message.pixel_mask_enabled == message.pixel_mask_enabled); CHECK(output_message.space_group_number == message.space_group_number); @@ -246,7 +246,7 @@ TEST_CASE("CBORSerialize_End", "[CBOR]") { REQUIRE(output_message.images_collected_count == message.images_collected_count); REQUIRE(output_message.images_sent_to_write_count == message.images_sent_to_write_count); REQUIRE(output_message.efficiency); - REQUIRE(output_message.efficiency == Approx(message.efficiency.value())); + REQUIRE(output_message.efficiency == Catch::Approx(message.efficiency.value())); REQUIRE(output_message.end_date == message.end_date); REQUIRE(output_message.series_id == message.series_id); REQUIRE(output_message.series_unique_id == message.series_unique_id); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 42e1fc90..fdb37362 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -40,7 +40,7 @@ ADD_EXECUTABLE(CatchTest RegressionTest.cpp ) -target_link_libraries(CatchTest JFJochBroker JFJochReceiver JFJochWriter JFJochImageAnalysis JFJochCommon JFJochHLSSimulation JFJochPreview JFJochResonet) +target_link_libraries(CatchTest Catch2WithMain JFJochBroker JFJochReceiver JFJochWriter JFJochImageAnalysis JFJochCommon JFJochHLSSimulation JFJochPreview JFJochResonet) target_include_directories(CatchTest PRIVATE .) INSTALL(TARGETS CatchTest RUNTIME) diff --git a/tests/CoordTest.cpp b/tests/CoordTest.cpp index 3ff31b1a..8d0fb391 100644 --- a/tests/CoordTest.cpp +++ b/tests/CoordTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/Coord.h" TEST_CASE("Coord_Comparison", "[LinearAlgebra][Coord]") { @@ -57,9 +57,9 @@ TEST_CASE("Coord_Scalar_div", "[LinearAlgebra][Coord]") { Coord a{1, 2, 3}; auto scalar_div = a / 4; - CHECK(scalar_div.x == Approx(a.x * 0.25)); - CHECK(scalar_div.y == Approx(a.y * 0.25)); - CHECK(scalar_div.z == Approx(a.z * 0.25)); + CHECK(scalar_div.x == Catch::Approx(a.x * 0.25)); + CHECK(scalar_div.y == Catch::Approx(a.y * 0.25)); + CHECK(scalar_div.z == Catch::Approx(a.z * 0.25)); } TEST_CASE("Coord_dot", "[LinearAlgebra][Coord]") { @@ -102,15 +102,15 @@ TEST_CASE("Coord_operator_bracket","[LinearAlgebra][Coord]") { TEST_CASE("Coord_normalize","[LinearAlgebra][Coord]") { Coord a{4,0,0}; REQUIRE(a.Length() == 4.0); - REQUIRE(a.Normalize().Length() == Approx(1.0)); - REQUIRE(a.Normalize().x == Approx(1.0)); + REQUIRE(a.Normalize().Length() == Catch::Approx(1.0)); + REQUIRE(a.Normalize().x == Catch::Approx(1.0)); REQUIRE(a.Normalize().y == 0.0); REQUIRE(a.Normalize().z == 0.0); Coord b{3, 4, 5}; - REQUIRE(b.Length() == Approx(sqrt(3*3+4*4+5*5))); - REQUIRE(b.Normalize().Length() == Approx(1.0)); - REQUIRE(b.Normalize().x == Approx(3 /sqrt(3*3+4*4+5*5))); - REQUIRE(b.Normalize().y == Approx(4 /sqrt(3*3+4*4+5*5))); - REQUIRE(b.Normalize().z == Approx(5 /sqrt(3*3+4*4+5*5))); + REQUIRE(b.Length() == Catch::Approx(sqrt(3*3+4*4+5*5))); + REQUIRE(b.Normalize().Length() == Catch::Approx(1.0)); + REQUIRE(b.Normalize().x == Catch::Approx(3 /sqrt(3*3+4*4+5*5))); + REQUIRE(b.Normalize().y == Catch::Approx(4 /sqrt(3*3+4*4+5*5))); + REQUIRE(b.Normalize().z == Catch::Approx(5 /sqrt(3*3+4*4+5*5))); } diff --git a/tests/DetectorGeometryTest.cpp b/tests/DetectorGeometryTest.cpp index 5721c42e..7ee71b93 100644 --- a/tests/DetectorGeometryTest.cpp +++ b/tests/DetectorGeometryTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/DetectorGeometry.h" TEST_CASE("DetectorGeometry_Regular", "[DetectorGeometry]") { diff --git a/tests/DetectorSetupTest.cpp b/tests/DetectorSetupTest.cpp index 6231a9a8..bc0e2213 100644 --- a/tests/DetectorSetupTest.cpp +++ b/tests/DetectorSetupTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/DetectorSetup.h" TEST_CASE("DetectorSetup_MismatchInSize") { @@ -15,7 +15,7 @@ TEST_CASE("DetectorSetup_ProtoBuf") { REQUIRE(setup.GetDescription() == "JF"); REQUIRE(setup.GetDetectorModuleHostname().size() == 4); REQUIRE(setup.GetDetectorModuleHostname()[3] == "mx4"); - REQUIRE(setup.GetPixelSize_mm() == Approx(0.075)); + REQUIRE(setup.GetPixelSize_mm() == Catch::Approx(0.075)); REQUIRE(setup.GetModulesNum() == 4); REQUIRE(setup.GetGeometry().GetModulesNum() == 4); } diff --git a/tests/DiffractionExperimentTest.cpp b/tests/DiffractionExperimentTest.cpp index 14d94cb9..770ccd11 100644 --- a/tests/DiffractionExperimentTest.cpp +++ b/tests/DiffractionExperimentTest.cpp @@ -1,7 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#define CATCH_CONFIG_MAIN -#include +#include #include "../common/DiffractionExperiment.h" #include "../compression/JFJochCompressor.h" @@ -399,14 +398,14 @@ TEST_CASE("DiffractionExperiment_Metadata","[DiffractionExperiment]") { x.PhotonEnergy_keV(6.0); REQUIRE(x.GetPhotonEnergy_keV() == 6.0); - REQUIRE(x.GetWavelength_A() == Approx(12.39854 / 6.0)); + REQUIRE(x.GetWavelength_A() == Catch::Approx(12.39854 / 6.0)); x.DetectorDistance_mm(30.0).BeamX_pxl(1200).BeamY_pxl(1000).FrameTime(900us); - REQUIRE(x.GetBeamX_pxl() == Approx(1200)); - REQUIRE(x.GetBeamY_pxl() == Approx(1000)); + REQUIRE(x.GetBeamX_pxl() == Catch::Approx(1200)); + REQUIRE(x.GetBeamY_pxl() == Catch::Approx(1000)); - REQUIRE(x.GetDetectorDistance_mm() == Approx(30.0)); + REQUIRE(x.GetDetectorDistance_mm() == Catch::Approx(30.0)); REQUIRE_THROWS(x.PedestalG0Frames(-1)); REQUIRE_THROWS(x.PedestalG1Frames(-1)); @@ -537,16 +536,16 @@ TEST_CASE("DiffractionExperiment_RadialIntegration_LowQ","[DiffractionExperiment REQUIRE_THROWS(x.LowQForAzimInt_recipA(50)); x.LowQForAzimInt_recipA(4); - REQUIRE(x.GetLowQForAzimInt_recipA() == Approx(4)); + REQUIRE(x.GetLowQForAzimInt_recipA() == Catch::Approx(4)); REQUIRE_THROWS(x.LowResForAzimInt_A(0)); REQUIRE_THROWS(x.LowResForAzimInt_A(-1)); x.LowResForAzimInt_A(5.0); - REQUIRE(x.GetLowQForAzimInt_recipA() == Approx(2 * M_PI / 5.0)); + REQUIRE(x.GetLowQForAzimInt_recipA() == Catch::Approx(2 * M_PI / 5.0)); DiffractionExperiment y(x); - REQUIRE(y.GetLowQForAzimInt_recipA() == Approx(2 * M_PI / 5.0)); + REQUIRE(y.GetLowQForAzimInt_recipA() == Catch::Approx(2 * M_PI / 5.0)); } @@ -558,26 +557,26 @@ TEST_CASE("DiffractionExperiment_RadialIntegration_HighQ","[DiffractionExperimen REQUIRE_THROWS(x.HighQForAzimInt_recipA(50)); x.HighQForAzimInt_recipA(8); - REQUIRE(x.GetHighQForAzimInt_recipA() == Approx(8.0)); + REQUIRE(x.GetHighQForAzimInt_recipA() == Catch::Approx(8.0)); REQUIRE_THROWS(x.HighResForAzimInt_A(0)); REQUIRE_THROWS(x.HighResForAzimInt_A(-1)); x.HighResForAzimInt_A(3.0); - REQUIRE(x.GetHighQForAzimInt_recipA() == Approx(2 * M_PI / 3.0)); + REQUIRE(x.GetHighQForAzimInt_recipA() == Catch::Approx(2 * M_PI / 3.0)); DiffractionExperiment y(x); - REQUIRE(y.GetHighQForAzimInt_recipA() == Approx(2 * M_PI / 3.0)); + REQUIRE(y.GetHighQForAzimInt_recipA() == Catch::Approx(2 * M_PI / 3.0)); } TEST_CASE("DiffractionExperiment_RadialIntegration_QSpacing","[DiffractionExperiment]") { DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36)); x.QSpacingForAzimInt_recipA(0.456); - REQUIRE(x.GetQSpacingForAzimInt_recipA() == Approx(0.456)); + REQUIRE(x.GetQSpacingForAzimInt_recipA() == Catch::Approx(0.456)); DiffractionExperiment y(x); - REQUIRE(y.GetQSpacingForAzimInt_recipA() == Approx(0.456)); + REQUIRE(y.GetQSpacingForAzimInt_recipA() == Catch::Approx(0.456)); } TEST_CASE("DiffractionExperiment_StorageCells","[DiffractionExperiment]") { diff --git a/tests/DiffractionGeometryTest.cpp b/tests/DiffractionGeometryTest.cpp index f293ea68..d8f4263d 100644 --- a/tests/DiffractionGeometryTest.cpp +++ b/tests/DiffractionGeometryTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/DiffractionGeometry.h" #include @@ -12,8 +12,8 @@ TEST_CASE("RecipToDetector_1", "[LinearAlgebra][Coord]") { auto recip = DetectorToRecip(x, pos_x, pos_y); auto [proj_x, proj_y] = RecipToDector(x, recip); - REQUIRE(proj_x == Approx(pos_x)); - REQUIRE(proj_y == Approx(pos_y)); + REQUIRE(proj_x == Catch::Approx(pos_x)); + REQUIRE(proj_y == Catch::Approx(pos_y)); REQUIRE((recip - DetectorToRecip(x, proj_x, proj_y)).Length() < 0.00000001f); REQUIRE(DistFromEwaldSphere(x, recip) < 4e-4); } @@ -25,8 +25,8 @@ TEST_CASE("RecipToDetector_2", "[LinearAlgebra][Coord]") { auto recip = DetectorToRecip(x, pos_x, pos_y); auto [proj_x, proj_y] = RecipToDector(x, recip); - REQUIRE(proj_x == Approx(pos_x)); - REQUIRE(proj_y == Approx(pos_y)); + REQUIRE(proj_x == Catch::Approx(pos_x)); + REQUIRE(proj_y == Catch::Approx(pos_y)); REQUIRE((recip - DetectorToRecip(x, proj_x, proj_y)).Length() < 0.00000001f); REQUIRE(DistFromEwaldSphere(x, recip) < 4e-4); } @@ -38,8 +38,8 @@ TEST_CASE("RecipToDetector_3", "[LinearAlgebra][Coord]") { auto recip = DetectorToRecip(x, pos_x, pos_y); auto [proj_x, proj_y] = RecipToDector(x, recip); - REQUIRE(proj_x == Approx(pos_x)); - REQUIRE(proj_y == Approx(pos_y)); + REQUIRE(proj_x == Catch::Approx(pos_x)); + REQUIRE(proj_y == Catch::Approx(pos_y)); REQUIRE((recip - DetectorToRecip(x, proj_x, proj_y)).Length() < 0.00000001f); REQUIRE(DistFromEwaldSphere(x, recip) < 4e-4); } @@ -49,9 +49,9 @@ TEST_CASE("Phi","") { x.DetectorDistance_mm(75).PhotonEnergy_keV(WVL_1A_IN_KEV); x.BeamX_pxl(1000).BeamY_pxl(1000); - REQUIRE(Phi(x, 2000, 1000) == Approx(0.0)); - REQUIRE(Phi(x, 1000, 2000) == Approx(M_PI_2)); - REQUIRE(Phi(x, 2000, 2000) == Approx(M_PI_4)); + REQUIRE(Phi(x, 2000, 1000) == Catch::Approx(0.0)); + REQUIRE(Phi(x, 1000, 2000) == Catch::Approx(M_PI_2)); + REQUIRE(Phi(x, 2000, 2000) == Catch::Approx(M_PI_4)); } TEST_CASE("Cos2Theta","") { @@ -62,7 +62,7 @@ TEST_CASE("Cos2Theta","") { // det distance == 1000 pixel // theta = 30 deg // tan(2 * theta) = sqrt(3) - REQUIRE(CosTwoTheta(x, 1000, 1000 * (1.0 + sqrt(3))) == Approx(0.5f)); + REQUIRE(CosTwoTheta(x, 1000, 1000 * (1.0 + sqrt(3))) == Catch::Approx(0.5f)); } TEST_CASE("PxlToRes","") { @@ -72,13 +72,13 @@ TEST_CASE("PxlToRes","") { // sin(theta) = 1/2 // theta = 30 deg // tan(2 * theta) = sqrt(3) - REQUIRE(PxlToRes(x, 0, 1000 * sqrt(3)) == Approx(1.0)); + REQUIRE(PxlToRes(x, 0, 1000 * sqrt(3)) == Catch::Approx(1.0)); // sin(theta) = 1/4 // theta = 14.47 deg // tan(2 * theta) = 0.55328333517 - REQUIRE(PxlToRes(x, 1000 * 0.55328333517 * cosf(1), 1000 * 0.55328333517 * sinf(1)) == Approx(2.0)); + REQUIRE(PxlToRes(x, 1000 * 0.55328333517 * cosf(1), 1000 * 0.55328333517 * sinf(1)) == Catch::Approx(2.0)); } TEST_CASE("ResToPxl","") { @@ -88,12 +88,12 @@ TEST_CASE("ResToPxl","") { // sin(theta) = 1/2 // theta = 30 deg // tan(2 * theta) = sqrt(3) - REQUIRE(ResToPxl(x, 1.0) == Approx(1000 * sqrt(3))); + REQUIRE(ResToPxl(x, 1.0) == Catch::Approx(1000 * sqrt(3))); // sin(theta) = 1/4 // theta = 14.47 deg // tan(2 * theta) = 0.55328333517 - REQUIRE(ResToPxl(x, 2.0) == Approx(1000 * 0.55328333517)); + REQUIRE(ResToPxl(x, 2.0) == Catch::Approx(1000 * 0.55328333517)); } TEST_CASE("SolidAngleCorrection","") { @@ -102,12 +102,12 @@ TEST_CASE("SolidAngleCorrection","") { x.BeamX_pxl(1000).BeamY_pxl(1000).DetectorDistance_mm(75); REQUIRE(CalcAzIntSolidAngleCorr(x, 0.0) == 1.0f); - REQUIRE(CalcAzIntSolidAngleCorr(x, 2 * M_PI) == Approx(0.5f * 0.5f * 0.5f)); + REQUIRE(CalcAzIntSolidAngleCorr(x, 2 * M_PI) == Catch::Approx(0.5f * 0.5f * 0.5f)); // theta = 30 deg // cos (2 * theta) = 1/2 REQUIRE(CalcAzIntSolidAngleCorr(x, 1000, 1000) == 1.0f); - REQUIRE(CalcAzIntSolidAngleCorr(x, 1000 * (1.0 + sqrt(3)), 1000) == Approx(0.5f * 0.5f * 0.5f)); + REQUIRE(CalcAzIntSolidAngleCorr(x, 1000 * (1.0 + sqrt(3)), 1000) == Catch::Approx(0.5f * 0.5f * 0.5f)); } TEST_CASE("PolarizationCorrection","") { @@ -117,17 +117,17 @@ TEST_CASE("PolarizationCorrection","") { // Circular polarization 0.5*(1+cos(2theta)^2) x.PolarizationFactor(0); - REQUIRE(CalcAzIntPolarizationCorr(x, 1000 * (1.0 + sqrt(3)), 1000) == Approx(0.5f * (1 + 0.5f * 0.5f))); - REQUIRE(CalcAzIntPolarizationCorr(x, 1000, 1000 * (1.0 + sqrt(3))) == Approx(0.5f * (1 + 0.5f * 0.5f))); + REQUIRE(CalcAzIntPolarizationCorr(x, 1000 * (1.0 + sqrt(3)), 1000) == Catch::Approx(0.5f * (1 + 0.5f * 0.5f))); + REQUIRE(CalcAzIntPolarizationCorr(x, 1000, 1000 * (1.0 + sqrt(3))) == Catch::Approx(0.5f * (1 + 0.5f * 0.5f))); // Horizontal polarization x.PolarizationFactor(1); // No correction in vertical direction - REQUIRE(CalcAzIntPolarizationCorr(x, 1000, 1000 * (1.0 + sqrt(3))) == Approx(1.0f)); - REQUIRE(CalcAzIntPolarizationCorr(x, 1000, 1000 * (1.0 - sqrt(3))) == Approx(1.0f)); + REQUIRE(CalcAzIntPolarizationCorr(x, 1000, 1000 * (1.0 + sqrt(3))) == Catch::Approx(1.0f)); + REQUIRE(CalcAzIntPolarizationCorr(x, 1000, 1000 * (1.0 - sqrt(3))) == Catch::Approx(1.0f)); // cos(2*theta)^2 in horizontal direction - REQUIRE(CalcAzIntPolarizationCorr(x, 1000 * (1.0 + sqrt(3)), 1000) == Approx(0.5f * 0.5f)); - REQUIRE(CalcAzIntPolarizationCorr(x, 1000 * (1.0 - sqrt(3)), 1000) == Approx(0.5f * 0.5f)); + REQUIRE(CalcAzIntPolarizationCorr(x, 1000 * (1.0 + sqrt(3)), 1000) == Catch::Approx(0.5f * 0.5f)); + REQUIRE(CalcAzIntPolarizationCorr(x, 1000 * (1.0 - sqrt(3)), 1000) == Catch::Approx(0.5f * 0.5f)); } diff --git a/tests/DiffractionSpotTest.cpp b/tests/DiffractionSpotTest.cpp index daa5c2f1..3257445c 100644 --- a/tests/DiffractionSpotTest.cpp +++ b/tests/DiffractionSpotTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/DiffractionSpot.h" TEST_CASE("DiffractionSpot_ConvertToImageCoordinates", "[LinearAlgebra][Coord]") { @@ -15,7 +15,7 @@ TEST_CASE("DiffractionSpot_ConvertToImageCoordinates", "[LinearAlgebra][Coord]") REQUIRE(spot_1.Count() == 12 * 2 + 4 * 2); spot_1.ConvertToImageCoordinates(experiment, 1); - REQUIRE(spot_1.RawCoord().x == Approx(CONVERTED_MODULE_COLS + 8 + 800.5 + 6)); - REQUIRE(spot_1.RawCoord().y == Approx(CONVERTED_MODULE_LINES * 2 + 36 - 1 - 300.25 - 2)); + REQUIRE(spot_1.RawCoord().x == Catch::Approx(CONVERTED_MODULE_COLS + 8 + 800.5 + 6)); + REQUIRE(spot_1.RawCoord().y == Catch::Approx(CONVERTED_MODULE_LINES * 2 + 36 - 1 - 300.25 - 2)); REQUIRE(spot_1.Count() == 12 * 2 + 4 * 2); } diff --git a/tests/FPGAEigerReorderTest.cpp b/tests/FPGAEigerReorderTest.cpp index dbff9bc5..ec04cffb 100644 --- a/tests/FPGAEigerReorderTest.cpp +++ b/tests/FPGAEigerReorderTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../fpga/hls/hls_jfjoch.h" TEST_CASE("FPGA_EigerReorderTest") { diff --git a/tests/FPGAFrameGeneratorTest.cpp b/tests/FPGAFrameGeneratorTest.cpp index 7e7f1009..43d4c99c 100644 --- a/tests/FPGAFrameGeneratorTest.cpp +++ b/tests/FPGAFrameGeneratorTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../fpga/hls/hls_jfjoch.h" TEST_CASE("FPGA_FrameGenerator_Cancel") { diff --git a/tests/FPGAHostWriterTest.cpp b/tests/FPGAHostWriterTest.cpp index dc46a9b4..f68e8648 100644 --- a/tests/FPGAHostWriterTest.cpp +++ b/tests/FPGAHostWriterTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../fpga/hls/hls_jfjoch.h" TEST_CASE("FPGA_FrameWriterTestIgnore") { diff --git a/tests/FPGAIntegrationTest.cpp b/tests/FPGAIntegrationTest.cpp index 093515af..592a2e93 100644 --- a/tests/FPGAIntegrationTest.cpp +++ b/tests/FPGAIntegrationTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include "../jungfrau/JFPedestalCalc.h" @@ -367,7 +367,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range", "[FPGA][Full]") { for (const auto energy : energy_values) { x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -418,7 +418,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_HG0", "[FPGA][Full]") { x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy); REQUIRE(x.IsUsingGainHG0()); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -448,7 +448,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_HG0", "[FPGA][Full]") { x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy); REQUIRE(!x.IsUsingGainHG0()); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -499,7 +499,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_fixedG1", "[FPGA][Full]") { x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy); REQUIRE(x.IsFixedGainG1()); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -549,7 +549,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_I32", "[FPGA][Full]") { for (const auto energy : energy_values) { x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy).FPGAOutputMode(FPGAPixelOutput::Int32); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -602,7 +602,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_sum4", "[FPGA][Full]") { logger.Info("Trying with {} keV", energy); x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy).Summation(nsummation); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -654,7 +654,7 @@ TEST_CASE("HLS_C_Simulation_check_convert_full_range_U16", "[FPGA][Full]") { logger.Info("Trying with {} keV", energy); x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).PhotonEnergy_keV(energy).FPGAOutputMode(FPGAPixelOutput::Uint16); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); JFCalibration c_in(x); c_in.Pedestal(0,0) = pedestal_g0; @@ -815,7 +815,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_convert_full_range", "[FPG x.Mode(DetectorMode::Conversion); x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).UseInternalPacketGenerator(true).PhotonEnergy_keV(energy); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); auto gain_from_file = GainCalibrationFromTestFile(); @@ -870,7 +870,7 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_convert_full_range_adu_his x.Mode(DetectorMode::Conversion); x.PedestalG0Frames(0).NumTriggers(1).ImagesPerTrigger(1).UseInternalPacketGenerator(true).PhotonEnergy_keV(energy); - REQUIRE(x.GetPhotonEnergy_keV() == Approx(energy)); + REQUIRE(x.GetPhotonEnergy_keV() == Catch::Approx(energy)); auto gain_from_file = GainCalibrationFromTestFile(); @@ -1477,23 +1477,23 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_integration", "[FPGA][Full REQUIRE(memcmp(imageBuf, frame.data(), RAW_MODULE_SIZE * sizeof(uint16_t)) == 0); auto integration_result = test.GetDeviceOutput(0, 0)->integration_result; - CHECK(integration_result[0].sum == Approx(32754LU * (RAW_MODULE_SIZE / 2))); + CHECK(integration_result[0].sum == Catch::Approx(32754LU * (RAW_MODULE_SIZE / 2))); CHECK(integration_result[0].count == RAW_MODULE_SIZE / 2); CHECK(integration_result[1].sum == 0); CHECK(integration_result[1].count == 0); - CHECK(integration_result[FPGA_INTEGRATION_BIN_COUNT - 1].sum == Approx(32754LU * (RAW_MODULE_SIZE / 2 - 1))); + CHECK(integration_result[FPGA_INTEGRATION_BIN_COUNT - 1].sum == Catch::Approx(32754LU * (RAW_MODULE_SIZE / 2 - 1))); CHECK(integration_result[FPGA_INTEGRATION_BIN_COUNT - 1].count == RAW_MODULE_SIZE / 2 - 1); integration_result = test.GetDeviceOutput(0, 1)->integration_result; - CHECK(integration_result[54].sum == Approx(32754LU * (RAW_MODULE_SIZE))); + CHECK(integration_result[54].sum == Catch::Approx(32754LU * (RAW_MODULE_SIZE))); CHECK(integration_result[54].count == RAW_MODULE_SIZE); integration_result = test.GetDeviceOutput(0, 2)->integration_result; - CHECK(integration_result[54].sum == Approx(32754 * (RAW_MODULE_SIZE))); + CHECK(integration_result[54].sum == Catch::Approx(32754 * (RAW_MODULE_SIZE))); CHECK(integration_result[54].count == RAW_MODULE_SIZE); integration_result = test.GetDeviceOutput(0, 3)->integration_result; - CHECK(integration_result[54].sum == Approx(32754 * (RAW_MODULE_SIZE))); + CHECK(integration_result[54].sum == Catch::Approx(32754 * (RAW_MODULE_SIZE))); CHECK(integration_result[54].count == RAW_MODULE_SIZE); } @@ -2150,13 +2150,13 @@ TEST_CASE("HLS_C_Simulation_internal_packet_generator_roi_calc", "[FPGA][Full]") for (int m = 0; m < x.GetModulesNum(); m++) { CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].sum == 83 + 95 + 13 + 125); CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].sum2 == 83 * 83 + 95 * 95 + 13 * 13 + 125 * 125); - CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].sum_x_weighted == Approx(83 * 12 + 95 * 13 + 13 * 12 + 125 * 13)); - CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].sum_y_weighted == Approx(83 * 3 + 95 * 3 + 13 * 4 + 125 * 4)); + CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].sum_x_weighted == Catch::Approx(83 * 12 + 95 * 13 + 13 * 12 + 125 * 13)); + CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].sum_y_weighted == Catch::Approx(83 * 3 + 95 * 3 + 13 * 4 + 125 * 4)); CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].max_value == 125); CHECK (test.GetDeviceOutput(i, m)->roi_counts[0].good_pixels == 4); - CHECK (test.GetDeviceOutput(i, m)->roi_counts[1].sum_x_weighted == Approx(83 * (812+6) + 95 * (813+6) + 13 * (812+6) + 125 * (813+6))); - CHECK (test.GetDeviceOutput(i, m)->roi_counts[1].sum_y_weighted == Approx(83 * (303+2) + 95 * (303+2) + 13 * (304+2) + 125 * (304+2))); + CHECK (test.GetDeviceOutput(i, m)->roi_counts[1].sum_x_weighted == Catch::Approx(83 * (812+6) + 95 * (813+6) + 13 * (812+6) + 125 * (813+6))); + CHECK (test.GetDeviceOutput(i, m)->roi_counts[1].sum_y_weighted == Catch::Approx(83 * (303+2) + 95 * (303+2) + 13 * (304+2) + 125 * (304+2))); } } diff --git a/tests/FPGANetworkTest.cpp b/tests/FPGANetworkTest.cpp index 8af08ee7..ec2c4775 100644 --- a/tests/FPGANetworkTest.cpp +++ b/tests/FPGANetworkTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include #include diff --git a/tests/FPGASpotFindingUnitTest.cpp b/tests/FPGASpotFindingUnitTest.cpp index b73f6381..db7bebe6 100644 --- a/tests/FPGASpotFindingUnitTest.cpp +++ b/tests/FPGASpotFindingUnitTest.cpp @@ -1,7 +1,7 @@ // Copyright (2019-2023) Paul Scherrer Institute #include -#include +#include #include "../fpga/hls/hls_jfjoch.h" diff --git a/tests/FrameTransformationTest.cpp b/tests/FrameTransformationTest.cpp index 4cb943a2..4ede6e38 100644 --- a/tests/FrameTransformationTest.cpp +++ b/tests/FrameTransformationTest.cpp @@ -1,12 +1,13 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include #include "../receiver/FrameTransformation.h" #include "../common/RawToConvertedGeometry.h" #include "../compression/JFJochDecompress.h" +#include using namespace std::literals::chrono_literals; diff --git a/tests/HDF5WritingTest.cpp b/tests/HDF5WritingTest.cpp index 5e442c72..2edc657c 100644 --- a/tests/HDF5WritingTest.cpp +++ b/tests/HDF5WritingTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include "../common/DiffractionExperiment.h" diff --git a/tests/HistogramTest.cpp b/tests/HistogramTest.cpp index 6aa3f1e2..791b18a1 100644 --- a/tests/HistogramTest.cpp +++ b/tests/HistogramTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../common/Histogram.h" diff --git a/tests/IndexingUnitTest.cpp b/tests/IndexingUnitTest.cpp index 81e9379a..95be7295 100644 --- a/tests/IndexingUnitTest.cpp +++ b/tests/IndexingUnitTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../writer/HDF5Objects.h" #include "../image_analysis/IndexerWrapper.h" @@ -8,54 +8,54 @@ TEST_CASE("CrystalLattice") { CrystalLattice l(make_unit_cell(50,60,80, 90, 90, 90)); - REQUIRE(l.Vec0().Length() == Approx(50)); - REQUIRE(l.Vec1().Length() == Approx(60)); - REQUIRE(l.Vec2().Length() == Approx(80)); + REQUIRE(l.Vec0().Length() == Catch::Approx(50)); + REQUIRE(l.Vec1().Length() == Catch::Approx(60)); + REQUIRE(l.Vec2().Length() == Catch::Approx(80)); REQUIRE(angle_deg(l.Vec0(), l.Vec2()) == 90); REQUIRE(angle_deg(l.Vec0(), l.Vec1()) == 90); REQUIRE(angle_deg(l.Vec1(), l.Vec2()) == 90); l = CrystalLattice(make_unit_cell(30, 40, 70, 90, 95, 90)); - REQUIRE(l.Vec0().Length() == Approx(30)); - REQUIRE(l.Vec1().Length() == Approx(40)); - REQUIRE(l.Vec2().Length() == Approx(70)); + REQUIRE(l.Vec0().Length() == Catch::Approx(30)); + REQUIRE(l.Vec1().Length() == Catch::Approx(40)); + REQUIRE(l.Vec2().Length() == Catch::Approx(70)); REQUIRE(angle_deg(l.Vec0(), l.Vec2()) == 95); REQUIRE(angle_deg(l.Vec0(), l.Vec1()) == 90); REQUIRE(angle_deg(l.Vec1(), l.Vec2()) == 90); l = CrystalLattice(make_unit_cell(45, 45, 70, 90, 90, 120)); - REQUIRE(l.Vec0().Length() == Approx(45)); - REQUIRE(l.Vec1().Length() == Approx(45)); - REQUIRE(l.Vec2().Length() == Approx(70)); - REQUIRE(angle_deg(l.Vec0(), l.Vec2()) == Approx(90)); - REQUIRE(angle_deg(l.Vec0(), l.Vec1()) == Approx(120)); - REQUIRE(angle_deg(l.Vec1(), l.Vec2()) == Approx(90)); + REQUIRE(l.Vec0().Length() == Catch::Approx(45)); + REQUIRE(l.Vec1().Length() == Catch::Approx(45)); + REQUIRE(l.Vec2().Length() == Catch::Approx(70)); + REQUIRE(angle_deg(l.Vec0(), l.Vec2()) == Catch::Approx(90)); + REQUIRE(angle_deg(l.Vec0(), l.Vec1()) == Catch::Approx(120)); + REQUIRE(angle_deg(l.Vec1(), l.Vec2()) == Catch::Approx(90)); } TEST_CASE("CrystalLattice_ReciprocalLattice") { CrystalLattice l(make_unit_cell(50,60,80, 78, 80, 120)); CrystalLattice rl = l.ReciprocalLattice(); - REQUIRE(l.Vec0() * rl.Vec0() == Approx(1.0)); + REQUIRE(l.Vec0() * rl.Vec0() == Catch::Approx(1.0)); REQUIRE(l.Vec0() * rl.Vec1() < 1e-5); REQUIRE(l.Vec0() * rl.Vec2() < 1e-5); REQUIRE(l.Vec1() * rl.Vec0() < 1e-5); - REQUIRE(l.Vec1() * rl.Vec1() == Approx(1.0)); + REQUIRE(l.Vec1() * rl.Vec1() == Catch::Approx(1.0)); REQUIRE(l.Vec1() * rl.Vec2() < 1e-5); REQUIRE(l.Vec2() * rl.Vec0() < 1e-5); REQUIRE(l.Vec2() * rl.Vec1() < 1e-5); - REQUIRE(l.Vec2() * rl.Vec2() == Approx(1.0)); + REQUIRE(l.Vec2() * rl.Vec2() == Catch::Approx(1.0)); } TEST_CASE("CrystalLattice_EigenMatrix") { CrystalLattice l1(make_unit_cell(50,60,80, 78, 80, 120)); auto m = l1.GetEigenMatrix(); CrystalLattice l2(m); - REQUIRE(l2.Vec0().x == Approx(l1.Vec0().x)); - REQUIRE(l2.Vec1().y == Approx(l1.Vec1().y)); - REQUIRE(l2.Vec2().x == Approx(l1.Vec2().x)); + REQUIRE(l2.Vec0().x == Catch::Approx(l1.Vec0().x)); + REQUIRE(l2.Vec1().y == Catch::Approx(l1.Vec1().y)); + REQUIRE(l2.Vec2().x == Catch::Approx(l1.Vec2().x)); } inline double round_err(double x) { @@ -90,9 +90,9 @@ TEST_CASE("FastFeedbackIndexer","[Indexing]") { REQUIRE(!ret.empty()); //auto uc = ret[0].GetUnitCell(); - //REQUIRE(c.a == Approx(uc.a)); - //REQUIRE(c.b == Approx(uc.b)); - //REQUIRE(c.c == Approx(uc.c)); + //REQUIRE(c.a == Catch::Approx(uc.a)); + //REQUIRE(c.b == Catch::Approx(uc.b)); + //REQUIRE(c.c == Catch::Approx(uc.c)); double err[3] = {0.0, 0.0, 0.0}; for (const auto &iter: recip) { diff --git a/tests/JFCalibrationTest.cpp b/tests/JFCalibrationTest.cpp index c0783968..9ed3662a 100644 --- a/tests/JFCalibrationTest.cpp +++ b/tests/JFCalibrationTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include #include "../jungfrau/JFCalibration.h" @@ -30,20 +30,20 @@ TEST_CASE("JFCalibration_GainStatistics","[JFCalibration]") { REQUIRE(s.size() == 4); - REQUIRE(s[0].gain_g0_mean == Approx(35.0)); - REQUIRE(s[1].gain_g0_mean == Approx(36.0)); - REQUIRE(s[2].gain_g0_mean == Approx(37.0)); - REQUIRE(s[3].gain_g0_mean == Approx(38.0)); + REQUIRE(s[0].gain_g0_mean == Catch::Approx(35.0)); + REQUIRE(s[1].gain_g0_mean == Catch::Approx(36.0)); + REQUIRE(s[2].gain_g0_mean == Catch::Approx(37.0)); + REQUIRE(s[3].gain_g0_mean == Catch::Approx(38.0)); - REQUIRE(s[0].gain_g1_mean == Approx(-56)); - REQUIRE(s[1].gain_g1_mean == Approx(-55)); - REQUIRE(s[2].gain_g1_mean == Approx(-54)); - REQUIRE(s[3].gain_g1_mean == Approx(-53)); + REQUIRE(s[0].gain_g1_mean == Catch::Approx(-56)); + REQUIRE(s[1].gain_g1_mean == Catch::Approx(-55)); + REQUIRE(s[2].gain_g1_mean == Catch::Approx(-54)); + REQUIRE(s[3].gain_g1_mean == Catch::Approx(-53)); - REQUIRE(s[0].gain_g2_mean == Approx(0/32.)); - REQUIRE(s[1].gain_g2_mean == Approx(1/32.)); - REQUIRE(s[2].gain_g2_mean == Approx(2/32.)); - REQUIRE(s[3].gain_g2_mean == Approx(3/32.)); + REQUIRE(s[0].gain_g2_mean == Catch::Approx(0/32.)); + REQUIRE(s[1].gain_g2_mean == Catch::Approx(1/32.)); + REQUIRE(s[2].gain_g2_mean == Catch::Approx(2/32.)); + REQUIRE(s[3].gain_g2_mean == Catch::Approx(3/32.)); } TEST_CASE("JFCalibration_PedestalAndMaskStatistics","[JFCalibration]") { @@ -64,17 +64,17 @@ TEST_CASE("JFCalibration_PedestalAndMaskStatistics","[JFCalibration]") { auto s1 = calibration.GetModuleStatistics(1); - REQUIRE(s1[0].pedestal_g0_mean == Approx(1000)); - REQUIRE(s1[0].pedestal_g1_mean == Approx(2000)); - REQUIRE(s1[0].pedestal_g2_mean == Approx(3000)); + REQUIRE(s1[0].pedestal_g0_mean == Catch::Approx(1000)); + REQUIRE(s1[0].pedestal_g1_mean == Catch::Approx(2000)); + REQUIRE(s1[0].pedestal_g2_mean == Catch::Approx(3000)); - REQUIRE(s1[1].pedestal_g0_mean == Approx(2000)); - REQUIRE(s1[1].pedestal_g1_mean == Approx(4000)); - REQUIRE(s1[1].pedestal_g2_mean == Approx(6000)); + REQUIRE(s1[1].pedestal_g0_mean == Catch::Approx(2000)); + REQUIRE(s1[1].pedestal_g1_mean == Catch::Approx(4000)); + REQUIRE(s1[1].pedestal_g2_mean == Catch::Approx(6000)); - REQUIRE(s1[2].pedestal_g0_mean == Approx(3000)); - REQUIRE(s1[2].pedestal_g1_mean == Approx(6000)); - REQUIRE(s1[2].pedestal_g2_mean == Approx(9000)); + REQUIRE(s1[2].pedestal_g0_mean == Catch::Approx(3000)); + REQUIRE(s1[2].pedestal_g1_mean == Catch::Approx(6000)); + REQUIRE(s1[2].pedestal_g2_mean == Catch::Approx(9000)); REQUIRE(s1[0].bad_pixels == 0); REQUIRE(s1[1].bad_pixels == 0); @@ -127,17 +127,17 @@ TEST_CASE("JFCalibration_Statistics_All","[JFCalibration]") { REQUIRE(s0[2].bad_pixels == 0); REQUIRE(s0[3].bad_pixels == 0); - REQUIRE(s0[4].pedestal_g0_mean == Approx(1000)); - REQUIRE(s0[4].pedestal_g1_mean == Approx(2000)); - REQUIRE(s0[4].pedestal_g2_mean == Approx(3000)); + REQUIRE(s0[4].pedestal_g0_mean == Catch::Approx(1000)); + REQUIRE(s0[4].pedestal_g1_mean == Catch::Approx(2000)); + REQUIRE(s0[4].pedestal_g2_mean == Catch::Approx(3000)); - REQUIRE(s0[5].pedestal_g0_mean == Approx(2000)); - REQUIRE(s0[5].pedestal_g1_mean == Approx(4000)); - REQUIRE(s0[5].pedestal_g2_mean == Approx(6000)); + REQUIRE(s0[5].pedestal_g0_mean == Catch::Approx(2000)); + REQUIRE(s0[5].pedestal_g1_mean == Catch::Approx(4000)); + REQUIRE(s0[5].pedestal_g2_mean == Catch::Approx(6000)); - REQUIRE(s0[6].pedestal_g0_mean == Approx(3000)); - REQUIRE(s0[6].pedestal_g1_mean == Approx(6000)); - REQUIRE(s0[6].pedestal_g2_mean == Approx(9000)); + REQUIRE(s0[6].pedestal_g0_mean == Catch::Approx(3000)); + REQUIRE(s0[6].pedestal_g1_mean == Catch::Approx(6000)); + REQUIRE(s0[6].pedestal_g2_mean == Catch::Approx(9000)); REQUIRE(s0[4].bad_pixels == 0); REQUIRE(s0[5].bad_pixels == 0); diff --git a/tests/JFConversionTest.cpp b/tests/JFConversionTest.cpp index 040be7fd..5f18a42f 100644 --- a/tests/JFConversionTest.cpp +++ b/tests/JFConversionTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../jungfrau/JFConversionFloatingPoint.h" #include "../tests/FPGAUnitTest.h" diff --git a/tests/JFJochBrokerParserTest.cpp b/tests/JFJochBrokerParserTest.cpp index 83acb0b5..9930230c 100644 --- a/tests/JFJochBrokerParserTest.cpp +++ b/tests/JFJochBrokerParserTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../broker/JFJochBrokerParser.h" using namespace nlohmann::literals; diff --git a/tests/JFJochReceiverIntegrationTest.cpp b/tests/JFJochReceiverIntegrationTest.cpp index 187d9147..004f4437 100644 --- a/tests/JFJochReceiverIntegrationTest.cpp +++ b/tests/JFJochReceiverIntegrationTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../receiver/JFJochReceiverTest.h" #include "../acquisition_device/HLSSimulatedDevice.h" @@ -442,10 +442,10 @@ TEST_CASE("JFJochReceiverTest_PedestalG0_StorageCell", "[JFJochReceiver]") { JFModulePedestal out_pedestal_2 = output.pedestal_result[2]; JFModulePedestal out_pedestal_3 = output.pedestal_result[3]; - REQUIRE(out_pedestal_0.Mean() == Approx(5670)); - REQUIRE(out_pedestal_1.Mean() == Approx(4560)); - REQUIRE(out_pedestal_2.Mean() == Approx(3450)); - REQUIRE(out_pedestal_3.Mean() == Approx(2000)); + REQUIRE(out_pedestal_0.Mean() == Catch::Approx(5670)); + REQUIRE(out_pedestal_1.Mean() == Catch::Approx(4560)); + REQUIRE(out_pedestal_2.Mean() == Catch::Approx(3450)); + REQUIRE(out_pedestal_3.Mean() == Catch::Approx(2000)); } TEST_CASE("JFJochReceiverTest_PedestalG1_NoFrames", "[JFJochReceiver]") { diff --git a/tests/JFJochReceiverProcessingTest.cpp b/tests/JFJochReceiverProcessingTest.cpp index 3c16781a..6eb0da33 100644 --- a/tests/JFJochReceiverProcessingTest.cpp +++ b/tests/JFJochReceiverProcessingTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include diff --git a/tests/JFJochStateMachineTest.cpp b/tests/JFJochStateMachineTest.cpp index 9f84aa40..a719c6f9 100644 --- a/tests/JFJochStateMachineTest.cpp +++ b/tests/JFJochStateMachineTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../broker/JFJochStateMachine.h" using namespace std::literals::chrono_literals; diff --git a/tests/JFPedestalTest.cpp b/tests/JFPedestalTest.cpp index bd46c042..69cbbc4e 100644 --- a/tests/JFPedestalTest.cpp +++ b/tests/JFPedestalTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include "../jungfrau/JFModulePedestal.h" @@ -12,7 +12,7 @@ TEST_CASE("JFPedestal_Mean","[JFModulePedestal]") { for (int i = 0; i < RAW_MODULE_SIZE; i++) pedestal_arr[i] = 2455; - REQUIRE(pedestal.Mean() == Approx(2455)); + REQUIRE(pedestal.Mean() == Catch::Approx(2455)); } TEST_CASE("JFPedestal_GetPedestal","[JFModulePedestal]") { diff --git a/tests/JPEGTest.cpp b/tests/JPEGTest.cpp index 66172afe..cd2b9087 100644 --- a/tests/JPEGTest.cpp +++ b/tests/JPEGTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include #include "../preview//WriteJPEG.h" diff --git a/tests/LossyFilterTest.cpp b/tests/LossyFilterTest.cpp index 1fec4aa3..8d01ab6d 100644 --- a/tests/LossyFilterTest.cpp +++ b/tests/LossyFilterTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../receiver/LossyFilter.h" TEST_CASE("LossyFilterDisabled","[LossyFilter]") { diff --git a/tests/NeuralNetResPredictorTest.cpp b/tests/NeuralNetResPredictorTest.cpp index 0f775191..d31aac6a 100644 --- a/tests/NeuralNetResPredictorTest.cpp +++ b/tests/NeuralNetResPredictorTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../writer/HDF5Objects.h" #include "../resonet/NeuralNetResPredictor.h" diff --git a/tests/PedestalCalcTest.cpp b/tests/PedestalCalcTest.cpp index 9d9846ea..b340cb57 100644 --- a/tests/PedestalCalcTest.cpp +++ b/tests/PedestalCalcTest.cpp @@ -1,6 +1,7 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include +#include #include "../jungfrau/JFPedestalCalc.h" TEST_CASE("JFPedestalCalc", "[JFPedestalCalc]") { diff --git a/tests/PixelMaskTest.cpp b/tests/PixelMaskTest.cpp index a60fcae8..a5010ac7 100644 --- a/tests/PixelMaskTest.cpp +++ b/tests/PixelMaskTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include "catch2/catch.hpp" +#include "catch2/catch_all.hpp" #include "../common/PixelMask.h" TEST_CASE("PixelMask_MaskModuleEdges","[PixelMask]") { diff --git a/tests/PreviewCounterTest.cpp b/tests/PreviewCounterTest.cpp index 4161cb89..019c28e5 100644 --- a/tests/PreviewCounterTest.cpp +++ b/tests/PreviewCounterTest.cpp @@ -1,7 +1,7 @@ // Copyright (2019-2023) Paul Scherrer Institute #include -#include +#include #include "../preview/PreviewCounter.h" TEST_CASE("PreviewCount", "") { diff --git a/tests/ROIMapTest.cpp b/tests/ROIMapTest.cpp index 320f9685..afeae0b3 100644 --- a/tests/ROIMapTest.cpp +++ b/tests/ROIMapTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../common/ROIMap.h" #include "../common/DiffractionExperiment.h" diff --git a/tests/RawToConvertedGeometryTest.cpp b/tests/RawToConvertedGeometryTest.cpp index c0714d21..96b6c23c 100644 --- a/tests/RawToConvertedGeometryTest.cpp +++ b/tests/RawToConvertedGeometryTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/RawToConvertedGeometry.h" @@ -9,7 +9,7 @@ TEST_CASE("RawToConvertedGeometry_Half_and_quarter","[RawToConvertedGeometry]") REQUIRE(half(7, 9, 20) == 7); REQUIRE(half(27, 9, 20) == 27); - REQUIRE(half(7, -10, 20) == Approx(3.5)); + REQUIRE(half(7, -10, 20) == Catch::Approx(3.5)); REQUIRE(half(7, 9, 20) == 7); REQUIRE(half(27, 9, 20) == 27); @@ -436,7 +436,7 @@ TEST_CASE("RawToConvertedGeometry_FP","[RawToConvertedGeometry]") { uint64_t diff = 0; for (int i = 0; i < x.GetModulesNum(2) * RAW_MODULE_SIZE; i++) { - if (input[i] != Approx(input2[i])) diff++; + if (input[i] != Catch::Approx(input2[i])) diff++; } REQUIRE(diff == 0); } @@ -519,6 +519,6 @@ TEST_CASE("RawToConvertedCoordinate_Coord","[RawToConvertedGeometry]") { Coord input(800.5, 300.25, 0); Coord c = RawToConvertedCoordinate(experiment, 1, input); - REQUIRE(Approx(c.x) == CONVERTED_MODULE_COLS + 8 + 800.5 + 6); // col 800 becomes 806 due to 3 chip boundaries - REQUIRE(Approx(c.y) == CONVERTED_MODULE_LINES * 2 + 36 - 1 - 300.25 - 2); // line 300 becomes 302 due to 1 chip boundary + REQUIRE(Catch::Approx(c.x) == CONVERTED_MODULE_COLS + 8 + 800.5 + 6); // col 800 becomes 806 due to 3 chip boundaries + REQUIRE(Catch::Approx(c.y) == CONVERTED_MODULE_LINES * 2 + 36 - 1 - 300.25 - 2); // line 300 becomes 302 due to 1 chip boundary } diff --git a/tests/RegressionTest.cpp b/tests/RegressionTest.cpp index 69a63179..1d9047d2 100644 --- a/tests/RegressionTest.cpp +++ b/tests/RegressionTest.cpp @@ -2,7 +2,7 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../image_analysis/Regression.h" @@ -14,6 +14,6 @@ TEST_CASE("Regression") { y[i] = 7 * i + 5; } auto reg = regression(x, y); - REQUIRE(reg.intercept == Approx(5.0)); - REQUIRE(reg.slope == Approx(7.0)); + REQUIRE(reg.intercept == Catch::Approx(5.0)); + REQUIRE(reg.slope == Catch::Approx(7.0)); } diff --git a/tests/SendBufferTest.cpp b/tests/SendBufferTest.cpp index 8a9d212b..ee8dcfa4 100644 --- a/tests/SendBufferTest.cpp +++ b/tests/SendBufferTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include "../common/SendBufferControl.h" diff --git a/tests/StatusVectorTest.cpp b/tests/StatusVectorTest.cpp index acd49ebb..68ccdd11 100644 --- a/tests/StatusVectorTest.cpp +++ b/tests/StatusVectorTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../common/StatusVector.h" TEST_CASE("StatusVector_GetMeanPerBin","[StatusVector]") { @@ -16,7 +16,7 @@ TEST_CASE("StatusVector_GetMeanPerBin","[StatusVector]") { REQUIRE(status_out.size() == 3); REQUIRE(status_out[0] == 11); REQUIRE(status_out[1] == 0); - REQUIRE(status_out[2] == Approx((45 + 44 + 41) / 3.0)); + REQUIRE(status_out[2] == Catch::Approx((45 + 44 + 41) / 3.0)); status_out = status_vector.GetMeanPerBin(500); @@ -25,8 +25,8 @@ TEST_CASE("StatusVector_GetMeanPerBin","[StatusVector]") { REQUIRE(status_out[1] == 0); REQUIRE(status_out[2] == 0); REQUIRE(status_out[3] == 0); - REQUIRE(status_out[4] == Approx(45)); - REQUIRE(status_out[5] == Approx((44+41)/2.0)); + REQUIRE(status_out[4] == Catch::Approx(45)); + REQUIRE(status_out[5] == Catch::Approx((44+41)/2.0)); status_out = status_vector.GetMeanPerBin(1); REQUIRE(status_out.size() == 2601); @@ -117,10 +117,10 @@ TEST_CASE("StatusVector_Plot","[StatusVector]") { REQUIRE(plot_out.size() == 1); REQUIRE(plot_out[0].x.size() == 3); REQUIRE(plot_out[0].y.size() == 3); - REQUIRE(plot_out[0].x[0] == Approx(500)); - REQUIRE(plot_out[0].y[0] == Approx(11)); - REQUIRE(plot_out[0].x[2] == Approx(2500)); - REQUIRE(plot_out[0].y[2] == Approx((45 + 44 + 41) / 3.0)); + REQUIRE(plot_out[0].x[0] == Catch::Approx(500)); + REQUIRE(plot_out[0].y[0] == Catch::Approx(11)); + REQUIRE(plot_out[0].x[2] == Catch::Approx(2500)); + REQUIRE(plot_out[0].y[2] == Catch::Approx((45 + 44 + 41) / 3.0)); } TEST_CASE("StatusVector_Plot_OneBin","[StatusVector]") { @@ -131,8 +131,8 @@ TEST_CASE("StatusVector_Plot_OneBin","[StatusVector]") { 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] == Approx(2.5)); - REQUIRE(plot_out[0].y[0] == Approx(11)); + REQUIRE(plot_out[0].x[0] == Catch::Approx(2.5)); + REQUIRE(plot_out[0].y[0] == Catch::Approx(11)); } @@ -144,9 +144,9 @@ TEST_CASE("StatusVector_Plot_NoBinning","[StatusVector]") { REQUIRE(plot_out.size() == 1); REQUIRE(plot_out[0].x.size() == 6); REQUIRE(plot_out[0].y.size() == 6); - REQUIRE(plot_out[0].x[0] == Approx(0)); - REQUIRE(plot_out[0].y[0] == Approx(0)); + REQUIRE(plot_out[0].x[0] == Catch::Approx(0)); + REQUIRE(plot_out[0].y[0] == Catch::Approx(0)); - REQUIRE(plot_out[0].x[5] == Approx(5)); - REQUIRE(plot_out[0].y[5] == Approx(11)); + REQUIRE(plot_out[0].x[5] == Catch::Approx(5)); + REQUIRE(plot_out[0].y[5] == Catch::Approx(11)); } diff --git a/tests/StreamWriterTest.cpp b/tests/StreamWriterTest.cpp index a7a139e3..1dd70be1 100644 --- a/tests/StreamWriterTest.cpp +++ b/tests/StreamWriterTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include "../writer/StreamWriter.h" diff --git a/tests/StrongPixelSetTest.cpp b/tests/StrongPixelSetTest.cpp index d19d1c0a..54b4160b 100644 --- a/tests/StrongPixelSetTest.cpp +++ b/tests/StrongPixelSetTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include "../image_analysis/StrongPixelSet.h" TEST_CASE("DiffractionSpot_AddOperator","[StrongPixelSet]") { @@ -12,8 +12,8 @@ TEST_CASE("DiffractionSpot_AddOperator","[StrongPixelSet]") { REQUIRE(spot2.Count() == 5); REQUIRE(spot1.Count() == 15); - REQUIRE(spot1.RawCoord().x == Approx((4*10+3*5)/15.0)); - REQUIRE(spot1.RawCoord().y == Approx((1*10+4*5)/15.0)); + REQUIRE(spot1.RawCoord().x == Catch::Approx((4*10+3*5)/15.0)); + REQUIRE(spot1.RawCoord().y == Catch::Approx((1*10+4*5)/15.0)); REQUIRE(spot1.MaxCount() == 10); REQUIRE(spot1.PixelCount() == 2); } @@ -44,8 +44,8 @@ TEST_CASE("StrongPixelSet_BuildSpots","[StrongPixelSet]") { REQUIRE(spots[0].Count() == 9.0f); REQUIRE(spots[0].PixelCount() == 9); - REQUIRE(spots[0].RawCoord().x == Approx(7.0)); - REQUIRE(spots[0].RawCoord().y == Approx(105.0)); + REQUIRE(spots[0].RawCoord().x == Catch::Approx(7.0)); + REQUIRE(spots[0].RawCoord().y == Catch::Approx(105.0)); } /* diff --git a/tests/TIFFTest.cpp b/tests/TIFFTest.cpp index 6c51214b..2122f21c 100644 --- a/tests/TIFFTest.cpp +++ b/tests/TIFFTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2024) Paul Scherrer Institute -#include +#include #include diff --git a/tests/ThreadSafeFIFOSetTest.cpp b/tests/ThreadSafeFIFOSetTest.cpp index 4cbcadcd..b2615332 100644 --- a/tests/ThreadSafeFIFOSetTest.cpp +++ b/tests/ThreadSafeFIFOSetTest.cpp @@ -1,6 +1,6 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include <../common/ThreadSafeFIFO.h> using namespace std::chrono_literals; diff --git a/tests/ZMQImagePusherTest.cpp b/tests/ZMQImagePusherTest.cpp index 48c12fdb..7139891c 100644 --- a/tests/ZMQImagePusherTest.cpp +++ b/tests/ZMQImagePusherTest.cpp @@ -1,6 +1,7 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include +#include #include "../writer/ZMQImagePuller.h" #include "../frame_serialize/ZMQStream2PusherGroup.h" diff --git a/tests/ZSTDCompressorTest.cpp b/tests/ZSTDCompressorTest.cpp index b300414e..68df7a31 100644 --- a/tests/ZSTDCompressorTest.cpp +++ b/tests/ZSTDCompressorTest.cpp @@ -1,9 +1,10 @@ // Copyright (2019-2023) Paul Scherrer Institute -#include +#include #include #include #include +#include #include "../compression/JFJochCompressor.h" #include "../compression/JFJochDecompress.h" diff --git a/tests/catch2/LICENSE.txt b/tests/catch2/LICENSE.txt deleted file mode 100644 index 36b7cd93..00000000 --- a/tests/catch2/LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/tests/catch2/catch.hpp b/tests/catch2/catch.hpp deleted file mode 100644 index d2a12427..00000000 --- a/tests/catch2/catch.hpp +++ /dev/null @@ -1,17970 +0,0 @@ -/* - * Catch v2.13.9 - * Generated: 2022-04-12 22:37:23.260201 - * ---------------------------------------------------------- - * This file has been merged from multiple headers. Please don't edit it directly - * Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED -// start catch.hpp - - -#define CATCH_VERSION_MAJOR 2 -#define CATCH_VERSION_MINOR 13 -#define CATCH_VERSION_PATCH 9 - -#ifdef __clang__ -# pragma clang system_header -#elif defined __GNUC__ -# pragma GCC system_header -#endif - -// start catch_suppress_warnings.h - -#ifdef __clang__ -# ifdef __ICC // icpc defines the __clang__ macro -# pragma warning(push) -# pragma warning(disable: 161 1682) -# else // __ICC -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wswitch-enum" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# endif -#elif defined __GNUC__ - // Because REQUIREs trigger GCC's -Wparentheses, and because still - // supported version of g++ have only buggy support for _Pragmas, - // Wparentheses have to be suppressed globally. -# pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details - -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunused-variable" -# pragma GCC diagnostic ignored "-Wpadded" -#endif -// end catch_suppress_warnings.h -#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) -# define CATCH_IMPL -# define CATCH_CONFIG_ALL_PARTS -#endif - -// In the impl file, we want to have access to all parts of the headers -// Can also be used to sanely support PCHs -#if defined(CATCH_CONFIG_ALL_PARTS) -# define CATCH_CONFIG_EXTERNAL_INTERFACES -# if defined(CATCH_CONFIG_DISABLE_MATCHERS) -# undef CATCH_CONFIG_DISABLE_MATCHERS -# endif -# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) -# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER -# endif -#endif - -#if !defined(CATCH_CONFIG_IMPL_ONLY) -// start catch_platform.h - -// See e.g.: -// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html -#ifdef __APPLE__ -# include -# if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \ - (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1) -# define CATCH_PLATFORM_MAC -# elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1) -# define CATCH_PLATFORM_IPHONE -# endif - -#elif defined(linux) || defined(__linux) || defined(__linux__) -# define CATCH_PLATFORM_LINUX - -#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) -# define CATCH_PLATFORM_WINDOWS -#endif - -// end catch_platform.h - -#ifdef CATCH_IMPL -# ifndef CLARA_CONFIG_MAIN -# define CLARA_CONFIG_MAIN_NOT_DEFINED -# define CLARA_CONFIG_MAIN -# endif -#endif - -// start catch_user_interfaces.h - -namespace Catch { - unsigned int rngSeed(); -} - -// end catch_user_interfaces.h -// start catch_tag_alias_autoregistrar.h - -// start catch_common.h - -// start catch_compiler_capabilities.h - -// Detect a number of compiler features - by compiler -// The following features are defined: -// -// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? -// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? -// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? -// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? -// **************** -// Note to maintainers: if new toggles are added please document them -// in configuration.md, too -// **************** - -// In general each macro has a _NO_ form -// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. -// Many features, at point of detection, define an _INTERNAL_ macro, so they -// can be combined, en-mass, with the _NO_ forms later. - -#ifdef __cplusplus - -# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -# define CATCH_CPP14_OR_GREATER -# endif - -# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -# define CATCH_CPP17_OR_GREATER -# endif - -#endif - -// Only GCC compiler should be used in this block, so other compilers trying to -// mask themselves as GCC should be ignored. -#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" ) - -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) - -#endif - -#if defined(__clang__) - -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) - -// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug -// which results in calls to destructors being emitted for each temporary, -// without a matching initialization. In practice, this can result in something -// like `std::string::~string` being called on an uninitialized value. -// -// For example, this code will likely segfault under IBM XL: -// ``` -// REQUIRE(std::string("12") + "34" == "1234") -// ``` -// -// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented. -# if !defined(__ibmxl__) && !defined(__CUDACC__) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */ -# endif - -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ - _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") - -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) - -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wgnu-zero-variadic-macro-arguments\"" ) - -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ - _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) - -#endif // __clang__ - -//////////////////////////////////////////////////////////////////////////////// -// Assume that non-Windows platforms support posix signals by default -#if !defined(CATCH_PLATFORM_WINDOWS) - #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS -#endif - -//////////////////////////////////////////////////////////////////////////////// -// We know some environments not to support full POSIX signals -#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) - #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -#endif - -#ifdef __OS400__ -# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS -# define CATCH_CONFIG_COLOUR_NONE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Android somehow still does not support std::to_string -#if defined(__ANDROID__) -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING -# define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Not all Windows environments support SEH properly -#if defined(__MINGW32__) -# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH -#endif - -//////////////////////////////////////////////////////////////////////////////// -// PS4 -#if defined(__ORBIS__) -# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE -#endif - -//////////////////////////////////////////////////////////////////////////////// -// Cygwin -#ifdef __CYGWIN__ - -// Required for some versions of Cygwin to declare gettimeofday -// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin -# define _BSD_SOURCE -// some versions of cygwin (most) do not support std::to_string. Use the libstd check. -// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 -# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ - && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) - -# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING - -# endif -#endif // __CYGWIN__ - -//////////////////////////////////////////////////////////////////////////////// -// Visual C++ -#if defined(_MSC_VER) - -// Universal Windows platform does not support SEH -// Or console colours (or console at all...) -# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) -# define CATCH_CONFIG_COLOUR_NONE -# else -# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH -# endif - -# if !defined(__clang__) // Handle Clang masquerading for msvc - -// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ -// _MSVC_TRADITIONAL == 0 means new conformant preprocessor -// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor -# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) -# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -# endif // MSVC_TRADITIONAL - -// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop` -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) ) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) ) -# endif // __clang__ - -#endif // _MSC_VER - -#if defined(_REENTRANT) || defined(_MSC_VER) -// Enable async processing, as -pthread is specified or no additional linking is required -# define CATCH_INTERNAL_CONFIG_USE_ASYNC -#endif // _MSC_VER - -//////////////////////////////////////////////////////////////////////////////// -// Check if we are compiled with -fno-exceptions or equivalent -#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) -# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED -#endif - -//////////////////////////////////////////////////////////////////////////////// -// DJGPP -#ifdef __DJGPP__ -# define CATCH_INTERNAL_CONFIG_NO_WCHAR -#endif // __DJGPP__ - -//////////////////////////////////////////////////////////////////////////////// -// Embarcadero C++Build -#if defined(__BORLANDC__) - #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// Use of __COUNTER__ is suppressed during code analysis in -// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly -// handled by it. -// Otherwise all supported compilers support COUNTER macro, -// but user still might want to turn it off -#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) - #define CATCH_INTERNAL_CONFIG_COUNTER -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// RTX is a special version of Windows that is real time. -// This means that it is detected as Windows, but does not provide -// the same set of capabilities as real Windows does. -#if defined(UNDER_RTSS) || defined(RTX64_BUILD) - #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH - #define CATCH_INTERNAL_CONFIG_NO_ASYNC - #define CATCH_CONFIG_COLOUR_NONE -#endif - -#if !defined(_GLIBCXX_USE_C99_MATH_TR1) -#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER -#endif - -// Various stdlib support checks that require __has_include -#if defined(__has_include) - // Check if string_view is available and usable - #if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW - #endif - - // Check if optional is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if byte is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # include - # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) - # define CATCH_INTERNAL_CONFIG_CPP17_BYTE - # endif - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - - // Check if variant is available and usable - # if __has_include() && defined(CATCH_CPP17_OR_GREATER) - # if defined(__clang__) && (__clang_major__ < 8) - // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 - // fix should be in clang 8, workaround in libstdc++ 8.2 - # include - # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # define CATCH_CONFIG_NO_CPP17_VARIANT - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) - # else - # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT - # endif // defined(__clang__) && (__clang_major__ < 8) - # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -#endif // defined(__has_include) - -#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) -# define CATCH_CONFIG_COUNTER -#endif -#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) -# define CATCH_CONFIG_WINDOWS_SEH -#endif -// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. -#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) -# define CATCH_CONFIG_POSIX_SIGNALS -#endif -// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. -#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) -# define CATCH_CONFIG_WCHAR -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) -# define CATCH_CONFIG_CPP11_TO_STRING -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL) -# define CATCH_CONFIG_CPP17_OPTIONAL -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) -# define CATCH_CONFIG_CPP17_STRING_VIEW -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) -# define CATCH_CONFIG_CPP17_VARIANT -#endif - -#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE) -# define CATCH_CONFIG_CPP17_BYTE -#endif - -#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) -# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) -# define CATCH_CONFIG_NEW_CAPTURE -#endif - -#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -# define CATCH_CONFIG_DISABLE_EXCEPTIONS -#endif - -#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) -# define CATCH_CONFIG_POLYFILL_ISNAN -#endif - -#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC) && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC) -# define CATCH_CONFIG_USE_ASYNC -#endif - -#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE) -# define CATCH_CONFIG_ANDROID_LOGWRITE -#endif - -#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -# define CATCH_CONFIG_GLOBAL_NEXTAFTER -#endif - -// Even if we do not think the compiler has that warning, we still have -// to provide a macro that can be used by the code. -#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION -#endif -#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION) -# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS -#endif -#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS -#endif - -// The goal of this macro is to avoid evaluation of the arguments, but -// still have the compiler warn on problems inside... -#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN) -# define CATCH_INTERNAL_IGNORE_BUT_WARN(...) -#endif - -#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#elif defined(__clang__) && (__clang_major__ < 5) -# undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif - -#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS -#endif - -#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -#define CATCH_TRY if ((true)) -#define CATCH_CATCH_ALL if ((false)) -#define CATCH_CATCH_ANON(type) if ((false)) -#else -#define CATCH_TRY try -#define CATCH_CATCH_ALL catch (...) -#define CATCH_CATCH_ANON(type) catch (type) -#endif - -#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) -#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#endif - -// end catch_compiler_capabilities.h -#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line -#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) -#ifdef CATCH_CONFIG_COUNTER -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) -#else -# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) -#endif - -#include -#include -#include - -// We need a dummy global operator<< so we can bring it into Catch namespace later -struct Catch_global_namespace_dummy {}; -std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); - -namespace Catch { - - struct CaseSensitive { enum Choice { - Yes, - No - }; }; - - class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; - - protected: - NonCopyable(); - virtual ~NonCopyable(); - }; - - struct SourceLineInfo { - - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} - - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - - bool empty() const noexcept { return file[0] == '\0'; } - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; - - char const* file; - std::size_t line; - }; - - std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - - // Bring in operator<< from global namespace into Catch namespace - // This is necessary because the overload of operator<< above makes - // lookup stop at namespace Catch - using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - std::string operator+() const; - }; - template - T const& operator + ( T const& value, StreamEndStop ) { - return value; - } -} - -#define CATCH_INTERNAL_LINEINFO \ - ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) - -// end catch_common.h -namespace Catch { - - struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); - }; - -} // end namespace Catch - -#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ - CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ - CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ - namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ - CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION - -// end catch_tag_alias_autoregistrar.h -// start catch_test_registry.h - -// start catch_interfaces_testcase.h - -#include - -namespace Catch { - - class TestSpec; - - struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); - }; - - class TestCase; - struct IConfig; - - struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; - }; - - bool isThrowSafe( TestCase const& testCase, IConfig const& config ); - bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); - std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); - std::vector const& getAllTestCasesSorted( IConfig const& config ); - -} - -// end catch_interfaces_testcase.h -// start catch_stringref.h - -#include -#include -#include -#include - -namespace Catch { - - /// A non-owning string class (similar to the forthcoming std::string_view) - /// Note that, because a StringRef may be a substring of another string, - /// it may not be null terminated. - class StringRef { - public: - using size_type = std::size_t; - using const_iterator = const char*; - - private: - static constexpr char const* const s_empty = ""; - - char const* m_start = s_empty; - size_type m_size = 0; - - public: // construction - constexpr StringRef() noexcept = default; - - StringRef( char const* rawChars ) noexcept; - - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} - - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} - - explicit operator std::string() const { - return std::string(m_start, m_size); - } - - public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { - return !(*this == other); - } - - auto operator[] ( size_type index ) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } - - public: // named queries - constexpr auto empty() const noexcept -> bool { - return m_size == 0; - } - constexpr auto size() const noexcept -> size_type { - return m_size; - } - - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const*; - - public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr( size_type start, size_type length ) const noexcept -> StringRef; - - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const*; - - constexpr auto isNullTerminated() const noexcept -> bool { - return m_start[m_size] == '\0'; - } - - public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } - }; - - auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; - auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; - - constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); - } -} // namespace Catch - -constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { - return Catch::StringRef( rawChars, size ); -} - -// end catch_stringref.h -// start catch_preprocessor.hpp - - -#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ -#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) -#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) - -#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ -// MSVC needs more evaluations -#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) -#else -#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) -#endif - -#define CATCH_REC_END(...) -#define CATCH_REC_OUT - -#define CATCH_EMPTY() -#define CATCH_DEFER(id) id CATCH_EMPTY() - -#define CATCH_REC_GET_END2() 0, CATCH_REC_END -#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 -#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 -#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT -#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) -#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) - -#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) - -#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) -#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) - -// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, -// and passes userdata as the first parameter to each invocation, -// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) -#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) - -#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) -#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ -#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ -#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__) -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) -#else -// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF -#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__) -#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__ -#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1) -#endif - -#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__ -#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name) - -#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) - -#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper()) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) -#else -#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper())) -#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) -#endif - -#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\ - CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__) - -#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0) -#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1) -#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2) -#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3) -#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4) -#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5) -#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6) -#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7) -#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8) -#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9) -#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) - -#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N - -#define INTERNAL_CATCH_TYPE_GEN\ - template struct TypeList {};\ - template\ - constexpr auto get_wrapper() noexcept -> TypeList { return {}; }\ - template class...> struct TemplateTypeList{};\ - template class...Cs>\ - constexpr auto get_wrapper() noexcept -> TemplateTypeList { return {}; }\ - template\ - struct append;\ - template\ - struct rewrap;\ - template class, typename...>\ - struct create;\ - template class, typename>\ - struct convert;\ - \ - template \ - struct append { using type = T; };\ - template< template class L1, typename...E1, template class L2, typename...E2, typename...Rest>\ - struct append, L2, Rest...> { using type = typename append, Rest...>::type; };\ - template< template class L1, typename...E1, typename...Rest>\ - struct append, TypeList, Rest...> { using type = L1; };\ - \ - template< template class Container, template class List, typename...elems>\ - struct rewrap, List> { using type = TypeList>; };\ - template< template class Container, template class List, class...Elems, typename...Elements>\ - struct rewrap, List, Elements...> { using type = typename append>, typename rewrap, Elements...>::type>::type; };\ - \ - template