MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / TEST

Function TEST

lib/mdflib/mdflib_test/src/testsicomment.cpp:14–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12namespace mdf::test {
13
14TEST(TestSiComment, Properties) {
15 SiComment comment;
16
17 constexpr std::string_view kTx = "SI Test Properties";
18 comment.Comment(MdString(kTx));
19
20
21 MdAlternativeName& path = comment.Path();
22 constexpr std::string_view kPath = "ACME Street";
23 path.AddAlternativeName(MdString(kPath));
24 EXPECT_EQ(path.AlternativeNames().size(), 1);
25
26 MdAlternativeName& bus = comment.Bus();
27 constexpr std::string_view kBus = "ACME Bus";
28 bus.AddAlternativeName(MdString(kBus));
29 EXPECT_EQ(bus.AlternativeNames().size(), 1);
30
31 constexpr std::string_view kProtocol = "ACME Protocol";
32 comment.Protocol(MdString(kProtocol));
33 EXPECT_EQ(comment.Protocol(), kProtocol);
34
35 const std::string xml_snippet = comment.ToXml();
36 std::cout << xml_snippet << std::endl;
37
38 SiComment comment1;
39 comment1.FromXml(xml_snippet);
40 EXPECT_EQ(comment1.Comment(), kTx);
41
42 EXPECT_EQ(comment1.Path().AlternativeNames().size(), 1);
43 EXPECT_EQ(comment1.Bus().AlternativeNames().size(), 1);
44 EXPECT_EQ(comment1.Protocol(), kProtocol);
45}
46
47} // end namespace mdf::test

Callers

nothing calls this directly

Calls 9

MdStringClass · 0.85
PathMethod · 0.80
AddAlternativeNameMethod · 0.80
BusMethod · 0.80
CommentMethod · 0.45
sizeMethod · 0.45
ProtocolMethod · 0.45
ToXmlMethod · 0.45
FromXmlMethod · 0.45

Tested by

no test coverage detected