Skip to content

Commit

Permalink
test: clang-format -i src/univalue/test/unitester.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoFalke committed Dec 20, 2024
1 parent fafa9cc commit faf7eac
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/univalue/test/unitester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,32 +68,32 @@

static std::string rtrim(std::string s)
{
s.erase(s.find_last_not_of(" \n\r\t")+1);
s.erase(s.find_last_not_of(" \n\r\t") + 1);
return s;
}

static void runtest(std::string filename, const std::string& jdata)
{
std::string prefix = filename.substr(0, 4);
std::string prefix = filename.substr(0, 4);

bool wantPass = (prefix == "pass") || (prefix == "roun");
bool wantFail = (prefix == "fail");
bool wantRoundTrip = (prefix == "roun");
assert(wantPass || wantFail);
bool wantPass = (prefix == "pass") || (prefix == "roun");
bool wantFail = (prefix == "fail");
bool wantRoundTrip = (prefix == "roun");
assert(wantPass || wantFail);

UniValue val;
bool testResult = val.read(jdata);
UniValue val;
bool testResult = val.read(jdata);

if (wantPass) {
assert(testResult == true);
} else {
assert(testResult == false);
}
if (wantPass) {
assert(testResult == true);
} else {
assert(testResult == false);
}

if (wantRoundTrip) {
std::string odata = val.write(0, 0);
assert(odata == rtrim(jdata));
}
if (wantRoundTrip) {
std::string odata = val.write(0, 0);
assert(odata == rtrim(jdata));
}
}

#define TEST_FILE(name) {#name, json_tests::name}
Expand Down Expand Up @@ -185,7 +185,7 @@ void no_nul_test()
assert(val.read({buf + 3, 7}));
}

int main (int argc, char *argv[])
int main(int argc, char* argv[])
{
for (const auto& [file, json] : tests) {
runtest(std::string{file}, std::string{json});
Expand Down

0 comments on commit faf7eac

Please sign in to comment.