// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include #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}})); }