| 181 | } |
| 182 | |
| 183 | static void test_findallfields(void) |
| 184 | { |
| 185 | std::string s = R"M( |
| 186 | i64: -1 |
| 187 | i32: -2 |
| 188 | u64: 3 |
| 189 | u32: 4 |
| 190 | d: 5.5 |
| 191 | f: 6.7 |
| 192 | m { |
| 193 | s: "string" |
| 194 | } |
| 195 | r { |
| 196 | s: "val2" |
| 197 | } |
| 198 | r { |
| 199 | s: "val3" |
| 200 | } |
| 201 | secondoption { |
| 202 | s: "2" |
| 203 | } |
| 204 | )M"; |
| 205 | |
| 206 | TestProto proto; |
| 207 | if (!google::protobuf::TextFormat::MergeFromString(cleanup(s), &proto)) |
| 208 | error("couldn't load test proto"); |
| 209 | |
| 210 | auto fields = findAllProtoFields(&proto); |
| 211 | std::vector<std::string> fieldNames; |
| 212 | for (const auto& e : fields) |
| 213 | fieldNames.push_back(e.path()); |
| 214 | std::ranges::sort(fieldNames, doj::alphanum_less<std::string>()); |
| 215 | |
| 216 | AssertThat(fieldNames, |
| 217 | Equals(std::vector<std::string>{"d", |
| 218 | "f", |
| 219 | "i32", |
| 220 | "i64", |
| 221 | "m.s", |
| 222 | "r[0].s", |
| 223 | "r[1].s", |
| 224 | "secondoption.s", |
| 225 | "u32", |
| 226 | "u64"})); |
| 227 | } |
| 228 | |
| 229 | static void test_rendering(void) |
| 230 | { |
no test coverage detected