12#error JSON_TEST_SRC must point to test source directory
17static std::string
rtrim(std::string s) {
18 s.erase(s.find_last_not_of(
" \n\r\t") + 1);
22static void runtest(std::string filename,
const std::string &
jdata) {
23 std::string
prefix = filename.substr(0, 4);
48 FILE *
f = fopen(filename.c_str(),
"r");
58 std::string s(buf,
bread);
69 "fail10.json",
"fail11.json",
"fail12.json",
"fail13.json",
"fail14.json",
70 "fail15.json",
"fail16.json",
"fail17.json",
72 "fail19.json",
"fail1.json",
"fail20.json",
"fail21.json",
"fail22.json",
73 "fail23.json",
"fail24.json",
"fail25.json",
"fail26.json",
"fail27.json",
74 "fail28.json",
"fail29.json",
"fail2.json",
"fail30.json",
"fail31.json",
75 "fail32.json",
"fail33.json",
"fail34.json",
"fail35.json",
"fail36.json",
86 "fail5.json",
"fail6.json",
"fail7.json",
"fail8.json",
88 "pass1.json",
"pass2.json",
"pass3.json",
"pass4.json",
105 assert(val[0].get_str() ==
"\"");
109 assert(val[0].get_str() ==
"\xc6\x91");
113 assert(val[0].get_str() ==
"\xe2\x86\x91");
117 assert(val[0].get_str() ==
"\xf0\x9d\x85\xa1");
121 char buf[] =
"___[1,2,3]___";
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
bool read(std::string_view raw)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static const char * filenames[]
static std::string rtrim(std::string s)
void unescape_unicode_test()
static void runtest(std::string filename, const std::string &jdata)
static void runtest_file(const char *filename_)
std::string srcdir(JSON_TEST_SRC)