DiffractionExperiment: Add test for exporting DetectorConfig with/without detector module hostnames

This commit is contained in:
2023-04-13 11:48:51 +02:00
parent 54fefc50f5
commit 9508459db0
2 changed files with 23 additions and 2 deletions

View File

@@ -1035,4 +1035,26 @@ TEST_CASE("DiffractionExperiment_Binning","[DiffractionExperiment]") {
REQUIRE(!x.GetBinning2x2());
REQUIRE(x.GetXPixelsNum() == RAW_MODULE_COLS);
REQUIRE(x.GetYPixelsNum() == 8 * RAW_MODULE_LINES);
}
TEST_CASE("DiffractionExperiment_DetectorModuleHostname","[DiffractionExperiment]") {
std::vector<std::string> h = {"mx1", "mx2", "mx3"};
DiffractionExperiment x(DetectorGeometry(8));
JFJochProtoBuf::DetectorConfig det_cfg;
JFJochProtoBuf::ReceiverNetworkConfig net_cfg;
net_cfg.add_fpga_mac_addr("AA:BB:CC:DD:EE:FF");
net_cfg.add_fpga_mac_addr("AA:BB:CC:DD:EE:FE");
// Before setting module hostname
REQUIRE_NOTHROW(det_cfg = x.DetectorConfig(net_cfg));
REQUIRE_NOTHROW(x.DetectorModuleHostname(h));
std::vector<std::string> h_out;
REQUIRE_NOTHROW(x.GetDetectorModuleHostname(h_out));
REQUIRE(h == h_out);
REQUIRE_THROWS(det_cfg = x.DetectorConfig(net_cfg));
x.Geometry(DetectorGeometry(3));
REQUIRE_NOTHROW(det_cfg = x.DetectorConfig(net_cfg));
}