// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include #include "../common/DetectorSettings.h" TEST_CASE("DetectorSettings_CountTime") { DetectorSettings d; REQUIRE_NOTHROW(d.FrameTime(std::chrono::microseconds(1000))); REQUIRE(d.GetFrameTime() == std::chrono::milliseconds(1)); REQUIRE(!d.GetCountTime()); REQUIRE_NOTHROW(d.FrameTime(std::chrono::microseconds(1000), std::chrono::microseconds(500))); REQUIRE(d.GetFrameTime() == std::chrono::milliseconds(1)); REQUIRE(d.GetCountTime()); REQUIRE(d.GetCountTime().value().count() == 500); } TEST_CASE("DetectorSettings_NeedsJUNGFRAURecalibration") { DetectorSettings d1; d1.EigerThreshold_keV(12.4).FixGainG1(true).PedestalG1Frames(1234); DetectorSettings d2 = d1; REQUIRE(!d1.NeedsJUNGFRAURecalibration(d1)); REQUIRE(!d1.NeedsJUNGFRAURecalibration(d2)); d1.DetectorDelay(std::chrono::microseconds(500)).EigerThreshold_keV(10.0).EigerBitDepth(32).InternalGeneratorImages(12); REQUIRE(!d2.NeedsJUNGFRAURecalibration(d1)); REQUIRE(!d1.NeedsJUNGFRAURecalibration(d2)); d1.FrameTime(std::chrono::microseconds(1000), std::chrono::microseconds(10)); REQUIRE(d1.NeedsJUNGFRAURecalibration(d2)); REQUIRE(d2.NeedsJUNGFRAURecalibration(d1)); REQUIRE(d1.NeedsJUNGFRAURecalibration(DetectorSettings())); }