MCPcopy Create free account
hub / github.com/ElementsProject/elements / runtest

Function runtest

src/univalue/test/unitester.cpp:32–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32static 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
56static void runtest_file(const char *filename_)
57{

Callers 1

runtest_fileFunction · 0.85

Calls 3

rtrimFunction · 0.85
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected