Files
Jungfraujoch/tests/DetectorSettingsTest.cpp
T
leonarski_f c2d15e22ab
Build Packages / build:rpm (rocky8_nocuda) (push) Failing after 5m48s
Build Packages / build:rpm (rocky9_nocuda) (push) Failing after 6m18s
Build Packages / build:rpm (ubuntu2204_nocuda) (push) Failing after 6m22s
Build Packages / build:rpm (ubuntu2404_nocuda) (push) Failing after 7m12s
Build Packages / build:rpm (rocky8_sls9) (push) Failing after 8m53s
Build Packages / XDS test (JFJoch plugin) (push) Has been cancelled
Build Packages / XDS test (neggia plugin) (push) Has been cancelled
Build Packages / Generate python client (push) Has been cancelled
Build Packages / Build documentation (push) Has been cancelled
Build Packages / Unit tests (push) Has been cancelled
Build Packages / Create release (push) Has been cancelled
Build Packages / build:rpm (ubuntu2204) (push) Has been cancelled
Build Packages / DIALS test (push) Has been cancelled
Build Packages / build:rpm (rocky8) (push) Has been cancelled
Build Packages / build:rpm (rocky9_sls9) (push) Has been cancelled
Build Packages / build:rpm (rocky9) (push) Has been cancelled
Build Packages / build:rpm (ubuntu2404) (push) Has been cancelled
Build Packages / XDS test (durin plugin) (push) Has been cancelled
Define time using std::chrono::nanosecond whenever possible, than if needed for I/O convert to micro/milli-seconds
2026-04-28 14:45:26 +02:00

35 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#include <catch2/catch_all.hpp>
#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() == std::chrono::microseconds(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()));
}