With module_sync on, the module made timing master was always module 0. The detector entry of the broker settings now takes master_module (default 0, must be below the module count; checked in DetectorSetup::MasterModule), and the SLS wrapper makes that module master. Deactivate now clears the master flag on all modules instead of only on module 0, so it no longer depends on which module was master. Regenerated from jfjoch_api.yaml: C++ server model (broker/gen), frontend client, Redoc page and the python-client Detector doc page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HVeDQrPqZ52Tp6rzzZGxf3
35 lines
1.2 KiB
C++
35 lines
1.2 KiB
C++
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <catch2/catch_all.hpp>
|
|
#include "../broker/JFJochBrokerParser.h"
|
|
|
|
static org::openapitools::server::model::Detector JungfrauDetectorJSON(const nlohmann::json &extra = nlohmann::json::object()) {
|
|
nlohmann::json j = {
|
|
{"description", "JF"},
|
|
{"type", "JUNGFRAU"},
|
|
{"standard_geometry", {{"nmodules", 4}, {"modules_in_row", 2}}}
|
|
};
|
|
j.update(extra);
|
|
org::openapitools::server::model::Detector d = j;
|
|
d.validate();
|
|
return d;
|
|
}
|
|
|
|
TEST_CASE("JFJochBrokerParser_MasterModule_Default") {
|
|
DetectorSetup setup = ParseDetectorSetup(JungfrauDetectorJSON());
|
|
REQUIRE(setup.GetModulesNum() == 4);
|
|
REQUIRE(setup.GetMasterModule() == 0);
|
|
}
|
|
|
|
TEST_CASE("JFJochBrokerParser_MasterModule") {
|
|
DetectorSetup setup = ParseDetectorSetup(JungfrauDetectorJSON({{"master_module", 2}}));
|
|
REQUIRE(setup.GetMasterModule() == 2);
|
|
REQUIRE(setup.IsModuleSync());
|
|
}
|
|
|
|
TEST_CASE("JFJochBrokerParser_MasterModule_OutOfRange") {
|
|
REQUIRE_THROWS(ParseDetectorSetup(JungfrauDetectorJSON({{"master_module", 4}})));
|
|
REQUIRE_THROWS(JungfrauDetectorJSON({{"master_module", -1}}));
|
|
}
|