File: test_dltctrlmsg.cpp

package info (click to toggle)
dlt-viewer 2.29.0~beta1-dfsg-1~exp2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 8,428 kB
  • sloc: cpp: 31,907; ansic: 4,231; xml: 492; sh: 282; makefile: 128
file content (28 lines) | stat: -rw-r--r-- 1,040 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <gtest/gtest.h>

#include <qdltctrlmsg.h>

#include <QByteArray>

TEST(CtrlPayload, parse) {
    // this is real payload of a dlt control message which collect from dlt-daemon
    const auto data = QByteArray::fromHex("030000000701005359530001004d475200ffff2200436f6e74657874206f66206d61696e20646c742073797374656d206d616e616765721200444c542053797374656d204d616e6167657272656d6f");

    auto payload = qdlt::msg::payload::parse(data, false);

    ASSERT_TRUE(std::holds_alternative<qdlt::msg::payload::GetLogInfo>(payload));
    auto getLogInfo = std::get<qdlt::msg::payload::GetLogInfo>(payload);
    EXPECT_EQ(getLogInfo.status, 7);
    ASSERT_EQ(getLogInfo.apps.size(), 1);

    auto app = getLogInfo.apps[0];
    EXPECT_EQ(app.id, "SYS");
    EXPECT_EQ(app.description, "DLT System Manager");
    ASSERT_EQ(app.ctxs.size(), 1);

    auto ctx = app.ctxs[0];
    EXPECT_EQ(ctx.id, "MGR");
    EXPECT_EQ(ctx.logLevel, -1);
    EXPECT_EQ(ctx.traceStatus, -1);
    EXPECT_EQ(ctx.description, "Context of main dlt system manager");
}