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

Function test_compare

src/tests/unit/statusevent.cpp:179–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178
179std::string test_compare(const Events::Status &lhs, const Events::Status &rhs, const bool expect)
180{
181 bool r = (lhs.major == rhs.major
182 && lhs.minor == rhs.minor
183 && lhs.message == rhs.message);
184 if (r != expect)
185 {
186 std::stringstream err;
187 err << "StatusEvent compare check FAIL: "
188 << "{" << lhs << "} == {" << rhs << "} returned "
189 << (r ? "true" : "false")
190 << " - expected: "
191 << (expect ? "true" : "false");
192 return err.str();
193 }
194
195 r = (lhs.major != rhs.major
196 || lhs.minor != rhs.minor
197 || lhs.message != rhs.message);
198 if (r == expect)
199 {
200 std::stringstream err;
201 err << "Negative StatusEvent compare check FAIL: "
202 << "{" << lhs << "} == {" << rhs << "} returned "
203 << (r ? "true" : "false")
204 << " - expected: "
205 << (expect ? "true" : "false");
206 return err.str();
207 }
208 return "";
209}
210
211
212TEST(StatusEvent, compare_eq_1)

Callers 1

TESTFunction · 0.70

Calls 1

strMethod · 0.45

Tested by

no test coverage detected