40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
// Copyright (2019-2022) Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include <catch2/catch.hpp>
|
|
#include "../receiver/host/MockAcquisitionDevice.h"
|
|
|
|
TEST_CASE("MockAcquisitionDevice") {
|
|
std::vector<uint16_t> module_data(RAW_MODULE_SIZE, 765);
|
|
|
|
DiffractionExperiment experiment(DetectorGeometry(8, 2));
|
|
experiment.DataStreams(2);
|
|
|
|
experiment.NumTriggers(1).ImagesPerTrigger(5);
|
|
MockAcquisitionDevice device(0, 128);
|
|
|
|
device.StartAction(experiment);
|
|
|
|
|
|
device.AddModule(1,0,module_data.data());
|
|
device.AddModule(1,1,module_data.data());
|
|
device.AddModule(4,0,module_data.data());
|
|
device.AddModule(5,1,module_data.data());
|
|
|
|
device.Terminate();
|
|
device.WaitForActionComplete();
|
|
|
|
JFJochProtoBuf::AcquisitionDeviceStatistics device_statistics;
|
|
REQUIRE_NOTHROW(device.SaveStatistics(experiment, device_statistics));
|
|
|
|
REQUIRE(memcmp(device.GetFrameBuffer(0,0), module_data.data(),
|
|
RAW_MODULE_SIZE * sizeof(uint16_t)) == 0);
|
|
REQUIRE(memcmp(device.GetFrameBuffer(0,1), module_data.data(),
|
|
RAW_MODULE_SIZE * sizeof(uint16_t)) == 0);
|
|
REQUIRE(memcmp(device.GetFrameBuffer(3,0), module_data.data(),
|
|
RAW_MODULE_SIZE * sizeof(uint16_t)) == 0);
|
|
REQUIRE(memcmp(device.GetFrameBuffer(4,1), module_data.data(),
|
|
RAW_MODULE_SIZE * sizeof(uint16_t)) == 0);
|
|
}
|
|
|