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

Function test_empty

src/tests/unit/attention-req.cpp:26–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace unittest {
25
26std::string test_empty(const Events::AttentionReq &ev, const bool expect)
27{
28 bool r = ev.empty();
29 if (expect != r)
30 {
31 return std::string("test_empty(): ")
32 + "ev.empty() = " + (r ? "true" : "false")
33 + " [expected: " + (expect ? "true" : "false") + "]";
34 }
35
36 r = (ClientAttentionType::UNSET == ev.type
37 && ClientAttentionGroup::UNSET == ev.group
38 && ev.Message().empty());
39 if (expect != r)
40 {
41 return std::string("test_empty() - Member check: ")
42 + "(" + std::to_string(static_cast<uint32_t>(ev.group)) + ", "
43 + std::to_string(static_cast<uint32_t>(ev.group)) + "', "
44 + "message.size=" + std::to_string(ev.message.size()) + ") ..."
45 + " is " + (r ? "EMPTY" : "NON-EMPTY")
46 + " [expected: " + (expect ? "EMPTY" : "NON-EMPTY") + "]";
47 }
48 return "";
49};
50
51
52TEST(AttentionReq, init_empty)

Callers 1

TESTFunction · 0.70

Calls 3

MessageMethod · 0.80
sizeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected