MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / BOOST_AUTO_TEST_CASE

Function BOOST_AUTO_TEST_CASE

src/test/script_assets_tests.cpp:149–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149BOOST_AUTO_TEST_CASE(script_assets_test)
150{
151 // See src/test/fuzz/script_assets_test_minimizer.cpp for information on how to generate
152 // the script_assets_test.json file used by this test.
153 SignatureCache signature_cache{DEFAULT_SIGNATURE_CACHE_BYTES};
154
155 const char* dir = std::getenv("DIR_UNIT_TEST_DATA");
156 BOOST_WARN_MESSAGE(dir != nullptr, "Variable DIR_UNIT_TEST_DATA unset, skipping script_assets_test");
157 if (dir == nullptr) return;
158 auto path = fs::path(dir) / "script_assets_test.json";
159 bool exists = fs::exists(path);
160 BOOST_WARN_MESSAGE(exists, "File $DIR_UNIT_TEST_DATA/script_assets_test.json not found, skipping script_assets_test");
161 if (!exists) return;
162 std::ifstream file{path.std_path()};
163 BOOST_CHECK(file.is_open());
164 file.seekg(0, std::ios::end);
165 size_t length = file.tellg();
166 file.seekg(0, std::ios::beg);
167 std::string data(length, '\0');
168 file.read(data.data(), data.size());
169 UniValue tests = read_json(data);
170 BOOST_CHECK(tests.isArray());
171 BOOST_CHECK(tests.size() > 0);
172
173 for (size_t i = 0; i < tests.size(); i++) {
174 AssetTest(tests[i], signature_cache);
175 }
176 file.close();
177}
178
179BOOST_AUTO_TEST_SUITE_END()

Callers

nothing calls this directly

Calls 9

existsFunction · 0.85
read_jsonFunction · 0.85
AssetTestFunction · 0.85
isArrayMethod · 0.80
pathClass · 0.50
readMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected