27 {
28 const char *paths[] = {
29 "data/sample.json",
30 "bin/data/sample.json",
31 "../bin/data/sample.json",
32 "../../bin/data/sample.json",
33 "../../../bin/data/sample.json"
34 };
35 FILE* fp = 0;
36 for (size_t i = 0; i < sizeof(paths) / sizeof(paths[0]); i++) {
37 fp = fopen(paths[i], "rb");
38 if (fp) {
40 break;
41 }
42 }
44
45 fseek(fp, 0, SEEK_END);
46 length_ =
static_cast<size_t>(ftell(fp));
47 fseek(fp, 0, SEEK_SET);
50 json_[readLength] =
'\0';
51 fclose(fp);
52
53 const char *abcde_paths[] = {
54 "data/abcde.txt",
55 "bin/data/abcde.txt",
56 "../bin/data/abcde.txt",
57 "../../bin/data/abcde.txt",
58 "../../../bin/data/abcde.txt"
59 };
60 fp = 0;
61 for (size_t i = 0; i < sizeof(abcde_paths) / sizeof(abcde_paths[0]); i++) {
62 fp = fopen(abcde_paths[i], "rb");
63 if (fp) {
65 break;
66 }
67 }
69 fclose(fp);
70 }
#define ASSERT_TRUE(condition)