MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / TEST

Function TEST

src/tests/unit/logmetadata.cpp:27–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace unittest {
26
27TEST(LogMetaDataValue, Create)
28{
29 LogMetaDataValue::Ptr mdv1 = LogMetaDataValue::Create("labelA",
30 "valueA");
31 EXPECT_STREQ(mdv1->label.c_str(), "labelA");
32 EXPECT_STREQ(mdv1->GetValue().c_str(), "valueA");
33 EXPECT_FALSE(mdv1->skip);
34
35 LogMetaDataValue::Ptr mdv2 = LogMetaDataValue::Create("labelB",
36 "A different value",
37 true);
38 EXPECT_STREQ(mdv2->label.c_str(), "labelB");
39 EXPECT_STREQ(mdv2->GetValue().c_str(), "A different value");
40 EXPECT_TRUE(mdv2->skip);
41
42 LogMetaDataValue::Ptr mdi1 = LogMetaDataValue::Create("labelC",
43 -12345);
44 EXPECT_STREQ(mdi1->label.c_str(), "labelC");
45 EXPECT_STREQ(mdi1->GetValue().c_str(), "-12345");
46 EXPECT_FALSE(mdi1->skip);
47
48 LogMetaDataValue::Ptr mdi2 = LogMetaDataValue::Create("labelD",
49 67890,
50 true);
51 EXPECT_STREQ(mdi2->label.c_str(), "labelD");
52 EXPECT_STREQ(mdi2->GetValue().c_str(), "67890");
53 EXPECT_TRUE(mdi2->skip);
54
55 LogTag::Ptr tag = LogTag::Create("dummysender", "dummyinterface");
56 LogMetaDataValue::Ptr mdv3 = LogMetaDataValue::Create("tag", tag);
57 EXPECT_STREQ(mdv3->label.c_str(), "tag");
58 EXPECT_STREQ(mdv3->GetValue().c_str(), tag->str().c_str());
59}
60
61
62TEST(LogMetaDataValue, op_stream_write)

Callers

nothing calls this directly

Calls 10

clearMethod · 0.80
GetMetaValueMethod · 0.80
DuplicateMethod · 0.80
GetMetaDataRecordsMethod · 0.80
sizeMethod · 0.80
GetValueMethod · 0.45
strMethod · 0.45
emptyMethod · 0.45
AddMetaMethod · 0.45

Tested by

no test coverage detected