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

Method Validate

src/tests/dbus/request-queue-service.cpp:254–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252
253
254 GVariant *Validate(GVariant *param)
255 {
256 glib2::Utils::checkParams(__func__, param, "(su)", 2);
257 std::string resp_prefix{glib2::Value::Extract<std::string>(param, 0)};
258 uint32_t iteration{glib2::Value::Extract<uint32_t>(param, 1)};
259
260 bool result = true;
261 for (const auto &slot : queue->DumpSlots())
262 {
263 std::ostringstream match_val;
264 match_val << resp_prefix
265 << slot.name << "_"
266 << std::to_string(iteration + slot.id);
267 if ((slot.provided && match_val.str() != slot.value))
268 {
269 result = false;
270 log << "FAILED: [" << std::to_string(slot.id) << "] "
271 << "name=" << slot.name << ", "
272 << "value='" << slot.value << "', "
273 << "expected='" << match_val.str() << "'"
274 << std::endl;
275 std::cerr << "FAILED: [" << std::to_string(slot.id) << "] "
276 << "name=" << slot.name << ", "
277 << "value='" << slot.value << "', "
278 << "expected='" << match_val.str() << "'"
279 << std::endl;
280 }
281 else if (!slot.provided)
282 {
283 result = false;
284 log << "FAILED: [" << std::to_string(slot.id) << "] "
285 << "name=" << slot.name << " -- not provided "
286 << std::endl;
287 std::cerr << "FAILED: [" << std::to_string(slot.id) << "] "
288 << "name=" << slot.name << " -- not provided "
289 << std::endl;
290 }
291 else
292 {
293 log << "Passed: ["
294 << std::to_string(slot.id) << "] "
295 << "name=" << slot.name
296 << "value='" << slot.value
297 << std::endl;
298 }
299 }
300 return glib2::Value::CreateTupleWrapped(result);
301 }
302};
303
304

Callers 1

ReqQueueMainMethod · 0.95

Calls 2

DumpSlotsMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected