MCPcopy Create free account
hub / github.com/Kitware/CMake / testMapFilter

Function testMapFilter

Tests/CMakeLib/testJSONHelpers.cxx:403–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

401}
402
403bool testMapFilter()
404{
405 Json::Value v(Json::objectValue);
406 cmJSONState state;
407 v["field1"] = "Hello";
408 v["field2"] = "world!";
409 v["ignore"] = "ignore";
410
411 std::map<std::string, std::string> m{ { "key", "default" } };
412 std::map<std::string, std::string> expected{ { "field1", "Hello" },
413 { "field2", "world!" } };
414 ASSERT_TRUE(StringMapFilterHelper(m, &v, &state));
415 ASSERT_TRUE(m == expected);
416
417 v = Json::arrayValue;
418 m = { { "key", "default" } };
419 ASSERT_TRUE(!StringMapFilterHelper(m, &v, &state));
420
421 m = { { "key", "default" } };
422 ASSERT_TRUE(StringMapFilterHelper(m, nullptr, &state));
423 ASSERT_TRUE(m.empty());
424
425 return true;
426}
427
428bool testOptional()
429{

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…