Currently, 4 source files rely on the definition of the read_json function provided in src/test/script_tests.cpp.
This PR breaks this entanglement, improves code structure and maintainability.
Currently, 4 source files rely on the definition of the read_json function provided in src/test/script_tests.cpp.
This PR breaks this entanglement, improves code structure and maintainability.
11 | + 12 | +UniValue read_json(const std::string& jsondata) 13 | +{ 14 | + UniValue v; 15 | + if (!v.read(jsondata) || !v.isArray()) { 16 | + BOOST_ERROR("Parse error.");
In theory it is not allowed to link boosttest to libtest_util, but given that CI didn't fail, BOOST_ERROR is probably header-only?
Ah ok. I think I have a slight preference to keep boost out of libtest_util, and thus out of the fuzz tests
~What about just moving the read_json function into the src/test/main.cpp source file?~
Ah ok. I think I have a slight preference to keep boost out of libtest_util, and thus out of the fuzz tests
We already have: https://github.com/bitcoin/bitcoin/blob/ea67232cdb80c4bc3f16fcd823f6f811fd8903e1/src/test/util/chainstate.h#L17
We can probably remove that, and keep it Boost free.
Might be better to use Assert in any case to avoid the dead, confusing and dangerous return? (Dangerous because it returns an empty array, potentially running no tests at all)
We already have:
This can probably be replaced by a LogPrint or so
Updated 57c9bfabe6a1cfda2a179a457ab93d03b279ee30 -> aa326abcfc63d842e77feb5e3cffc19926369416 (pr25974.01 -> pr25974.02):
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| ACK | fanquake |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
Rebased aa326abcfc63d842e77feb5e3cffc19926369416 -> 3394ad21b5a7e8ddfcc817e2eee996fb4b0bd4c6 (pr25974.02 -> pr25974.03) due to the conflict with #26286.
0 | @@ -0,0 +1,18 @@ 1 | +// Copyright (c) 2022 The Bitcoin Core developers 2 | +// Distributed under the MIT software license, see the accompanying 3 | +// file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | + 5 | +#include <test/util/json.h> 6 | + 7 | +#include <boost/test/unit_test.hpp>
why?
Rebased 3394ad21b5a7e8ddfcc817e2eee996fb4b0bd4c6 -> 7a820cee0e6408f5848799011d82dd29ee7fa8c5 (pr25974.03 -> pr25974.04):
ACK 7a820cee0e6408f5848799011d82dd29ee7fa8c5