@@ -424,12 +424,21 @@ export namespace CppUtils::UnitTest::Container::MeshNetwork
424424 suite.expectEqual(expectedValue.value(), "updated");
425425 });
426426
427+ suite.addTest("Contains", [&] {
428+ auto root = StringMeshNodePtr::makeRoot("root");
429+ auto child = StringMeshNodePtr::make("child");
430+ root["Branch"] >> child;
431+
432+ suite.expect(root.contains("Branch"));
433+ suite.expect(not root.contains("NonExistentBranch"));
434+ });
435+
427436 suite.addTest("Get node", [&] {
428437 auto root = StringMeshNodePtr::makeRoot("root");
429438 auto child = StringMeshNodePtr::make("child");
430- root["Children "] >> child;
439+ root["Branch "] >> child;
431440
432- auto childExpected = root["Children "][0];
441+ auto childExpected = root["Branch "][0];
433442
434443 suite.expect(childExpected.has_value());
435444 suite.expectEqual(childExpected.value().getValue().value(), "child");
@@ -438,7 +447,7 @@ export namespace CppUtils::UnitTest::Container::MeshNetwork
438447 suite.addTest("Get node: Non-existent branch", [&] {
439448 auto root = StringMeshNodePtr::makeRoot("root");
440449 auto child = StringMeshNodePtr::make("child");
441- root["Children "] >> child;
450+ root["Branch "] >> child;
442451
443452 auto invalidKeyExpected = root["NonExistentBranch"][0];
444453
@@ -449,9 +458,9 @@ export namespace CppUtils::UnitTest::Container::MeshNetwork
449458 suite.addTest("Get node: Invalid index", [&] {
450459 auto root = StringMeshNodePtr::makeRoot("root");
451460 auto child = StringMeshNodePtr::make("child");
452- root["Children "] >> child;
461+ root["Branch "] >> child;
453462
454- auto invalidIndexExpected = root["Children "][1];
463+ auto invalidIndexExpected = root["Branch "][1];
455464
456465 suite.expect(not invalidIndexExpected.has_value());
457466 suite.expectEqual(invalidIndexExpected.error(), "Branch index out of bounds"sv);
0 commit comments