mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-11 15:35:35 +02:00
Add test stub for RamBuffer
This commit is contained in:
@@ -3,6 +3,7 @@ add_executable(core-buffer-tests main.cpp)
|
||||
target_link_libraries(core-buffer-tests
|
||||
core-buffer-lib
|
||||
external
|
||||
rt
|
||||
hdf5
|
||||
hdf5_cpp
|
||||
zmq
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "test_buffer_utils.cpp"
|
||||
#include "test_bitshuffle.cpp"
|
||||
#include "test_RamBuffer.cpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "gtest/gtest.h"
|
||||
#include "RamBuffer.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace buffer_config;
|
||||
|
||||
TEST(RamBuffer, simple_store)
|
||||
{
|
||||
const int n_modules = 3;
|
||||
RamBuffer buffer("test_detector", n_modules, 10);
|
||||
|
||||
ModuleFrame frame_meta;
|
||||
frame_meta.pulse_id = 123523;
|
||||
frame_meta.daq_rec = 1234;
|
||||
frame_meta.frame_index = 12342300;
|
||||
frame_meta.n_recv_packets = JF_N_PACKETS_PER_FRAME;
|
||||
|
||||
auto frame_buffer = make_unique<uint16_t[]>(MODULE_N_PIXELS);
|
||||
|
||||
|
||||
for (size_t i = 0; i < MODULE_N_PIXELS; i++) {
|
||||
frame_buffer[i] = i % 100;
|
||||
}
|
||||
for (int i_module=0; i_module<n_modules; i_module++) {
|
||||
frame_meta.module_id = i_module;
|
||||
|
||||
buffer.write_frame(&frame_meta, (char *) (frame_buffer.get()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user