v1.0.0-rc.34
This commit is contained in:
+69
-5
@@ -49,7 +49,6 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") {
|
||||
.run_name = "bla",
|
||||
.run_number = 4567,
|
||||
.gain_file_names = {"abc" , "def", "/dsadasdsa/dadsadas/dsadsa/M056.bin"},
|
||||
.roi_names = {"roi0", "roi1"},
|
||||
.goniometer = GoniometerAxis{
|
||||
.name = "omega",
|
||||
.increment = 0.1f,
|
||||
@@ -76,7 +75,7 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") {
|
||||
.jungfrau_conversion_factor = 17.56f,
|
||||
.geometry_transformation_enabled = false,
|
||||
.overwrite = true,
|
||||
.hdf5_format_version = 2
|
||||
.hdf5_format_version = FileWriterFileFormat::NXmxVDS
|
||||
};
|
||||
|
||||
REQUIRE_NOTHROW(serializer.SerializeSequenceStart(message));
|
||||
@@ -152,7 +151,6 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") {
|
||||
REQUIRE(output_message.user_data.is_object());
|
||||
CHECK(output_message.user_data.size() == 2);
|
||||
CHECK(output_message.gain_file_names == message.gain_file_names);
|
||||
CHECK(output_message.roi_names == message.roi_names);
|
||||
CHECK(output_message.countrate_correction_enabled == message.countrate_correction_enabled);
|
||||
CHECK(output_message.flatfield_enabled == message.flatfield_enabled);
|
||||
CHECK(output_message.write_master_file == message.write_master_file);
|
||||
@@ -169,6 +167,68 @@ TEST_CASE("CBORSerialize_Start", "[CBOR]") {
|
||||
CHECK(output_message.hdf5_format_version == message.hdf5_format_version);
|
||||
}
|
||||
|
||||
TEST_CASE("CBORSerialize_ROI", "[CBOR]") {
|
||||
std::vector<uint8_t> buffer(8*1024*1024);
|
||||
CBORStream2Serializer serializer(buffer.data(), buffer.size());
|
||||
|
||||
StartMessage message {
|
||||
.rois = {
|
||||
ROIConfig{
|
||||
.type = ROIConfig::ROIType::Circle,
|
||||
.name = "roi1",
|
||||
.circle = ROIConfigCircle{
|
||||
.r = 3.0,
|
||||
.x = 5.0,
|
||||
.y = 4.0
|
||||
}
|
||||
},
|
||||
ROIConfig{
|
||||
.type = ROIConfig::ROIType::Box,
|
||||
.name = "roi2",
|
||||
.box = ROIConfigBox{
|
||||
.xmin = 5,
|
||||
.xmax = 12,
|
||||
.ymin = 7,
|
||||
.ymax = 3
|
||||
}
|
||||
},
|
||||
ROIConfig{
|
||||
.type = ROIConfig::ROIType::Azim,
|
||||
.name = "roi3",
|
||||
.azim = ROIConfigAzim{
|
||||
.qmin = 4.0,
|
||||
.qmax = 5.0
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
REQUIRE_NOTHROW(serializer.SerializeSequenceStart(message));
|
||||
|
||||
auto deserialized = CBORStream2Deserialize(buffer.data(), serializer.GetBufferSize());
|
||||
REQUIRE(deserialized);
|
||||
REQUIRE(deserialized->msg_type == CBORImageType::START);
|
||||
REQUIRE(deserialized->start_message);
|
||||
StartMessage &output_message = *deserialized->start_message;
|
||||
|
||||
REQUIRE(output_message.rois.size() == 3);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
CHECK(output_message.rois[i].name == message.rois[i].name);
|
||||
CHECK(output_message.rois[i].type == message.rois[i].type);
|
||||
}
|
||||
CHECK(output_message.rois[0].circle.x == message.rois[0].circle.x);
|
||||
CHECK(output_message.rois[0].circle.y == message.rois[0].circle.y);
|
||||
CHECK(output_message.rois[0].circle.r == message.rois[0].circle.r);
|
||||
|
||||
CHECK(output_message.rois[1].box.xmin == message.rois[1].box.xmin);
|
||||
CHECK(output_message.rois[1].box.xmax == message.rois[1].box.xmax);
|
||||
CHECK(output_message.rois[1].box.ymin == message.rois[1].box.ymin);
|
||||
CHECK(output_message.rois[1].box.ymax == message.rois[1].box.ymax);
|
||||
|
||||
CHECK(output_message.rois[2].azim.qmin == message.rois[2].azim.qmin );
|
||||
CHECK(output_message.rois[2].azim.qmax == message.rois[2].azim.qmax );
|
||||
}
|
||||
|
||||
TEST_CASE("CBORSerialize_Start_EmptyString", "[CBOR]") {
|
||||
std::vector<uint8_t> buffer(8*1024*1024);
|
||||
CBORStream2Serializer serializer(buffer.data(), buffer.size());
|
||||
@@ -726,8 +786,8 @@ TEST_CASE("CBORSerialize_Image_ROI", "[CBOR]") {
|
||||
.image = image,
|
||||
};
|
||||
|
||||
message.roi["roi0"] = {.sum = -876, .sum_square = 89998, .max_count = -1, .pixels = 4567};
|
||||
message.roi["roi1"] = {.sum = 876, .sum_square = 998, .max_count = 12, .pixels = 234};
|
||||
message.roi["roi0"] = {.sum = -876, .sum_square = 89998, .max_count = -1, .pixels = 4567, .x_weighted = 123, .y_weighted = 122};
|
||||
message.roi["roi1"] = {.sum = 876, .sum_square = 998, .max_count = 12, .pixels = 234, .x_weighted = -11222233443123LL, .y_weighted = -5};
|
||||
|
||||
REQUIRE_NOTHROW(serializer.SerializeImage(message));
|
||||
|
||||
@@ -747,11 +807,15 @@ TEST_CASE("CBORSerialize_Image_ROI", "[CBOR]") {
|
||||
CHECK(image_array.roi["roi0"].sum_square == message.roi["roi0"].sum_square);
|
||||
CHECK(image_array.roi["roi0"].max_count == message.roi["roi0"].max_count);
|
||||
CHECK(image_array.roi["roi0"].pixels == message.roi["roi0"].pixels);
|
||||
CHECK(image_array.roi["roi0"].x_weighted == message.roi["roi0"].x_weighted);
|
||||
CHECK(image_array.roi["roi0"].y_weighted == message.roi["roi0"].y_weighted);
|
||||
|
||||
CHECK(image_array.roi["roi1"].sum == message.roi["roi1"].sum);
|
||||
CHECK(image_array.roi["roi1"].sum_square == message.roi["roi1"].sum_square);
|
||||
CHECK(image_array.roi["roi1"].max_count == message.roi["roi1"].max_count);
|
||||
CHECK(image_array.roi["roi1"].pixels == message.roi["roi1"].pixels);
|
||||
CHECK(image_array.roi["roi1"].x_weighted == message.roi["roi1"].x_weighted);
|
||||
CHECK(image_array.roi["roi1"].y_weighted == message.roi["roi1"].y_weighted);
|
||||
}
|
||||
|
||||
TEST_CASE("CBORSerialize_Image_Append", "[CBOR]") {
|
||||
|
||||
Reference in New Issue
Block a user