5 const char *strings_file = "test/test-strings";
11 f = fopen(strings_file, "rb");
13 diag("Could not open %s: %s", strings_file, strerror(errno));
17 while (fgets(buffer, sizeof(buffer), f)) {
18 const char *s = chomp(buffer);
21 if (expect_literal(&s, "valid ")) {
23 } else if (expect_literal(&s, "invalid ")) {
26 fail("Invalid line in test-strings: %s", buffer);
30 if (strcmp(s, "\"1\\u2\"") == 0)
33 if (json_validate(s) == valid) {
34 pass("%s %s", valid ? "valid" : "invalid", s);
36 fail("%s is %s, but json_validate returned %s",
38 valid ? "valid" : "invalid",
39 valid ? "false" : "true");
43 if (ferror(f) || fclose(f) != 0) {
44 diag("I/O error reading test strings.");