| 401 | } |
| 402 | |
| 403 | bool 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 | |
| 428 | bool testOptional() |
| 429 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…