| 375 | } |
| 376 | |
| 377 | bool 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 | |
| 403 | bool testMapFilter() |
| 404 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…