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

Function testMap

Tests/CMakeLib/testJSONHelpers.cxx:377–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377bool testMap()
378{
379 Json::Value v(Json::objectValue);
380 v["field1"] = "Hello";
381 v["field2"] = "world!";
382 v["ignore"] = "ignore";
383 cmJSONState state;
384
385 std::map<std::string, std::string> m{ { "key", "default" } };
386 std::map<std::string, std::string> expected{ { "field1", "Hello" },
387 { "field2", "world!" },
388 { "ignore", "ignore" } };
389 ASSERT_TRUE(StringMapHelper(m, &v, &state));
390 ASSERT_TRUE(m == expected);
391
392 v = Json::arrayValue;
393 m = { { "key", "default" } };
394 ASSERT_TRUE(!StringMapHelper(m, &v, &state));
395
396 m = { { "key", "default" } };
397 ASSERT_TRUE(StringMapHelper(m, nullptr, &state));
398 ASSERT_TRUE(m.empty());
399
400 return true;
401}
402
403bool testMapFilter()
404{

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…