|
68 | 68 |
|
69 | 69 | static std::string rtrim(std::string s) |
70 | 70 | { |
71 | | - s.erase(s.find_last_not_of(" \n\r\t")+1); |
| 71 | + s.erase(s.find_last_not_of(" \n\r\t") + 1); |
72 | 72 | return s; |
73 | 73 | } |
74 | 74 |
|
75 | 75 | static void runtest(std::string filename, const std::string& jdata) |
76 | 76 | { |
77 | | - std::string prefix = filename.substr(0, 4); |
| 77 | + std::string prefix = filename.substr(0, 4); |
78 | 78 |
|
79 | | - bool wantPass = (prefix == "pass") || (prefix == "roun"); |
80 | | - bool wantFail = (prefix == "fail"); |
81 | | - bool wantRoundTrip = (prefix == "roun"); |
82 | | - assert(wantPass || wantFail); |
| 79 | + bool wantPass = (prefix == "pass") || (prefix == "roun"); |
| 80 | + bool wantFail = (prefix == "fail"); |
| 81 | + bool wantRoundTrip = (prefix == "roun"); |
| 82 | + assert(wantPass || wantFail); |
83 | 83 |
|
84 | | - UniValue val; |
85 | | - bool testResult = val.read(jdata); |
| 84 | + UniValue val; |
| 85 | + bool testResult = val.read(jdata); |
86 | 86 |
|
87 | | - if (wantPass) { |
88 | | - assert(testResult == true); |
89 | | - } else { |
90 | | - assert(testResult == false); |
91 | | - } |
| 87 | + if (wantPass) { |
| 88 | + assert(testResult == true); |
| 89 | + } else { |
| 90 | + assert(testResult == false); |
| 91 | + } |
92 | 92 |
|
93 | | - if (wantRoundTrip) { |
94 | | - std::string odata = val.write(0, 0); |
95 | | - assert(odata == rtrim(jdata)); |
96 | | - } |
| 93 | + if (wantRoundTrip) { |
| 94 | + std::string odata = val.write(0, 0); |
| 95 | + assert(odata == rtrim(jdata)); |
| 96 | + } |
97 | 97 | } |
98 | 98 |
|
99 | 99 | #define TEST_FILE(name) {#name, json_tests::name} |
@@ -185,7 +185,7 @@ void no_nul_test() |
185 | 185 | assert(val.read({buf + 3, 7})); |
186 | 186 | } |
187 | 187 |
|
188 | | -int main (int argc, char *argv[]) |
| 188 | +int main(int argc, char* argv[]) |
189 | 189 | { |
190 | 190 | for (const auto& [file, json] : tests) { |
191 | 191 | runtest(std::string{file}, std::string{json}); |
|
0 commit comments