1 #define CATCH_CONFIG_MAIN
2 #include <catch2/catch_test_macros.hpp>
5 #include "detections-utils.h"
6 #include "CelanturDetection.h"
8 TEST_CASE(
"Test protobuf serialisation",
"[protobuf]") {
9 std::vector<celantur::CelanturDetection> detections(2);
11 detections[0].class_id = 1;
12 detections[0].class_name =
"person";
13 detections[0].confidence = 0.9;
14 detections[0].box = cv::Rect(0, 0, 100, 100);
15 detections[0].model_class_id = 11;
17 detections[1].class_id = 2;
18 detections[1].class_name =
"car";
19 detections[1].confidence = 0.8;
20 detections[1].box = cv::Rect(100, 100, 200, 200);
21 detections[1].model_class_id = 22;
23 std::string serialised = celantur::serialise_detections_proto(detections);
24 std::vector<celantur::CelanturDetection> deserialised = celantur::deserialise_detections_proto(serialised);
26 REQUIRE(detections == deserialised);