Changeset View
Changeset View
Standalone View
Standalone View
src/test/script_tests.cpp
Show First 20 Lines • Show All 2,241 Lines • ▼ Show 20 Lines | std::set<std::string> tests_set; | ||||
json_tests::script_tests + sizeof(json_tests::script_tests))); | json_tests::script_tests + sizeof(json_tests::script_tests))); | ||||
for (unsigned int idx = 0; idx < json_tests.size(); idx++) { | for (unsigned int idx = 0; idx < json_tests.size(); idx++) { | ||||
const UniValue &tv = json_tests[idx]; | const UniValue &tv = json_tests[idx]; | ||||
tests_set.insert(JSONPrettyPrint(tv.get_array())); | tests_set.insert(JSONPrettyPrint(tv.get_array())); | ||||
} | } | ||||
} | } | ||||
#ifdef UPDATE_JSON_TESTS | |||||
std::string strGen; | std::string strGen; | ||||
#endif | |||||
for (TestBuilder &test : tests) { | for (TestBuilder &test : tests) { | ||||
test.Test(); | test.Test(); | ||||
std::string str = JSONPrettyPrint(test.GetJSON()); | std::string str = JSONPrettyPrint(test.GetJSON()); | ||||
#ifndef UPDATE_JSON_TESTS | #ifdef UPDATE_JSON_TESTS | ||||
strGen += str + ",\n"; | |||||
#else | |||||
if (tests_set.count(str) == 0) { | if (tests_set.count(str) == 0) { | ||||
BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + | BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + | ||||
test.GetComment()); | test.GetComment()); | ||||
} | } | ||||
#endif | #endif | ||||
strGen += str + ",\n"; | |||||
} | } | ||||
#ifdef UPDATE_JSON_TESTS | #ifdef UPDATE_JSON_TESTS | ||||
FILE *file = fopen("script_tests.json.gen", "w"); | FILE *file = fopen("script_tests.json.gen", "w"); | ||||
fputs(strGen.c_str(), file); | fputs(strGen.c_str(), file); | ||||
fclose(file); | fclose(file); | ||||
#endif | #endif | ||||
} | } | ||||
▲ Show 20 Lines • Show All 778 Lines • Show Last 20 Lines |