catch2: download with CMake + update to recent Catch2

This commit is contained in:
2024-05-14 21:31:34 +02:00
parent 9f1b6a6e96
commit eb0e5daf8f
47 changed files with 222 additions and 18206 deletions
+13 -14
View File
@@ -1,7 +1,6 @@
// Copyright (2019-2023) Paul Scherrer Institute
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <catch2/catch_all.hpp>
#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]") {