| 23 | namespace { |
| 24 | |
| 25 | TEST(UpdateLazy, Basic) { |
| 26 | struct UpdateJsonTest { |
| 27 | std::string target; |
| 28 | std::string source; |
| 29 | std::string updated; |
| 30 | }; |
| 31 | std::vector<UpdateJsonTest> tests = { |
| 32 | { |
| 33 | .target = "null", |
| 34 | .source = "123", |
| 35 | .updated = "123", |
| 36 | }, |
| 37 | { |
| 38 | .target = "[]", |
| 39 | .source = R"({"a":1})", |
| 40 | .updated = R"({"a":1})", |
| 41 | }, |
| 42 | { |
| 43 | .target = "[1,2,3]", |
| 44 | .source = R"([4,5,6])", |
| 45 | .updated = R"([4,5,6])", |
| 46 | }, |
| 47 | { |
| 48 | .target = R"({"a":2})", |
| 49 | .source = R"({"a":1})", |
| 50 | .updated = R"({"a":1})", |
| 51 | }, |
| 52 | { |
| 53 | .target = R"({"a":{"b":0}})", |
| 54 | .source = R"({"a":{"b":1}})", |
| 55 | .updated = R"({"a":{"b":1}})", |
| 56 | }, |
| 57 | { |
| 58 | .target = R"({"a":{"b":0}})", |
| 59 | .source = R"({"a":{"c":1}})", |
| 60 | .updated = R"({"a":{"b":0,"c":1}})", |
| 61 | }, |
| 62 | { |
| 63 | .target = R"({"a":{"b":0,"c":0}})", |
| 64 | .source = R"({"a":{"c":1}})", |
| 65 | .updated = R"({"a":{"b":0,"c":1}})", |
| 66 | }, |
| 67 | { |
| 68 | .target = R"({"a":{"b":0,"c":0,"d":0}})", |
| 69 | .source = R"({"a":{"c":1}})", |
| 70 | .updated = R"({"a":{"b":0,"c":1,"d":0}})", |
| 71 | }, |
| 72 | { |
| 73 | .target = R"({"b":0,"c":0,"d":0})", |
| 74 | .source = R"({"c":1})", |
| 75 | .updated = R"({"b":0,"c":1,"d":0})", |
| 76 | }, |
| 77 | { |
| 78 | .target = R"({"a":{"b":0, "c":0,"d":0}})", |
| 79 | .source = R"({"a":{"d":1}})", |
| 80 | .updated = R"({"a":{"b":0,"c":0,"d":1}})", |
| 81 | }, |
| 82 | { |
nothing calls this directly
no test coverage detected