| 30 | } |
| 31 | |
| 32 | static void runtest(std::string filename, const std::string& jdata) |
| 33 | { |
| 34 | std::string prefix = filename.substr(0, 4); |
| 35 | |
| 36 | bool wantPass = (prefix == "pass") || (prefix == "roun"); |
| 37 | bool wantFail = (prefix == "fail"); |
| 38 | bool wantRoundTrip = (prefix == "roun"); |
| 39 | assert(wantPass || wantFail); |
| 40 | |
| 41 | UniValue val; |
| 42 | bool testResult = val.read(jdata); |
| 43 | |
| 44 | if (wantPass) { |
| 45 | d_assert(testResult == true); |
| 46 | } else { |
| 47 | d_assert(testResult == false); |
| 48 | } |
| 49 | |
| 50 | if (wantRoundTrip) { |
| 51 | std::string odata = val.write(0, 0); |
| 52 | assert(odata == rtrim(jdata)); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | static void runtest_file(const char *filename_) |
| 57 | { |
no test coverage detected