extern_interface/tests/handler/test_telemetry.cpp

20 lines
822 B
C++
Raw Permalink Normal View History

#include "telemetry.h"
#include "setup.inc"
TEST_CASE(test_host_telemetry) {
auto request_msg = NewTelemetryRequestMsg(COM_FRAME_ADDRESS_VOIX, false);
g_telemetry_mock_transport->set_received_frame(request_msg);
auto telemetry_reply = g_telemetry_mock_transport->get_sent_frame();
assert(telemetry_reply);
assert_eq(g_telemetry_request_count, 1);
TelemetryData* telemetry_data = (TelemetryData*)ComFrame_PAYLOAD(telemetry_reply);
assert_eq(ComFrame_TYPE(telemetry_reply.get()), byteswaps(COM_FRAME_TYPE_TELEMETRY_ANSWER));
assert_eq(ComFrame_Length(telemetry_reply.get(), true), sizeof(ComFrameHeader) + sizeof(TelemetryData) + sizeof(uint16_t));
assert_eq(telemetry_data->application_version_high, 1);
assert_eq(telemetry_data->application_version_low, 2);
END_TEST;
}