zcashd/src/test
Jack Grigg 90232f65ae Rename libzcashconsensus.la -> libzcash_script.la 2021-01-25 22:20:25 +00:00
..
data add verbose mode to bitcoin-util-test.py 2020-10-28 16:07:25 +00:00
Checkpoints_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
DoS_tests.cpp Prefer explicit passing of CChainParams to the Params() global. 2020-12-15 08:23:09 -07:00
Makefile
README.md Update links 2020-12-13 11:24:44 +02:00
addrman_tests.cpp Update GetAdjustedTime() to GetTime(). 2020-02-25 16:57:22 +00:00
alert_tests.cpp Prefer explicit passing of CChainParams to the Params() global. 2020-12-15 08:23:09 -07:00
allocator_tests.cpp LockedPool: Make Arena::free and LockedPool::free noexcept 2020-09-28 16:20:06 +01:00
arith_uint256_tests.cpp Fixed multiple typos 2020-09-23 00:07:48 +01:00
base32_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
base58_tests.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2020-11-23 23:07:15 +00:00
base64_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
bctest.py Improve logging in bctest.py if there is a formatting mismatch 2020-10-28 16:20:53 +00:00
bech32_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
bip32_tests.cpp scripted-diff: Fully remove BOOST_FOREACH 2020-11-23 23:07:15 +00:00
bitcoin-util-test.py test: Fix pyflakes warning in bitcoin-util-test.py 2020-11-09 19:56:16 +00:00
bloom_tests.cpp Make evident the relationship between chainparams and key IO. 2020-07-09 17:48:47 -06:00
buildenv.py.in Update #! env for python3 2020-02-10 13:34:29 -08:00
checkblock_tests.cpp Remove `namespace fs=fs` 2020-10-22 01:11:37 +01:00
coins_tests.cpp Remove JSDescription::h_sig 2020-12-20 22:42:22 +00:00
compress_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
convertbits_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
crypto_tests.cpp Remove remaining OpenSSL references 2020-09-30 00:40:12 +01:00
dbwrapper_tests.cpp Replace uses of boost::filesystem with fs 2020-10-22 01:11:37 +01:00
equihash_tests.cpp Replace libsodium's crypto_generichash_blake2b with blake2b_simd 2020-09-24 15:58:14 +01:00
getarg_tests.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2020-11-23 23:07:15 +00:00
hash_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
key_tests.cpp scripted-diff: Migrate from boost::variant to std::variant 2020-12-16 22:49:53 +00:00
main_tests.cpp Set mainnet activation of Blossom 2019-11-01 09:31:55 -06:00
mempool_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
miner_tests.cpp scripted-diff: Fully remove BOOST_FOREACH 2020-11-23 23:07:15 +00:00
mruset_tests.cpp scripted-diff: Fully remove BOOST_FOREACH 2020-11-23 23:07:15 +00:00
multisig_tests.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2020-11-23 23:07:15 +00:00
netbase_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
pmt_tests.cpp Kill insecure_random and associated global state 2020-01-22 21:41:26 +00:00
policyestimator_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
pow_tests.cpp Prefer explicit passing of CChainParams to the Params() global. 2020-12-15 08:23:09 -07:00
prevector_tests.cpp scripted-diff: Remove BOOST_REVERSE_FOREACH 2020-11-23 23:07:15 +00:00
raii_event_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
reverselock_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
rpc_tests.cpp Auto merge of #4558 - linuxion:master, r=str4d 2020-09-28 22:40:09 +00:00
sanity_tests.cpp Minor additional OpenSSL scouring. 2020-09-30 10:44:42 +01:00
scheduler_tests.cpp depends: Boost 1.74.0 2020-10-05 19:48:46 +01:00
script_P2PKH_tests.cpp Fix buffer overflows in P2PKH tests 2020-08-26 14:01:40 -06:00
script_P2SH_tests.cpp wallet_ismine.h → script/ismine.h 2019-12-18 16:50:29 -06:00
script_standard_tests.cpp Auto merge of #4912 - daira:daira-partial-revert-4904, r=daira 2020-12-17 18:28:32 +00:00
script_tests.cpp Rename libzcashconsensus.la -> libzcash_script.la 2021-01-25 22:20:25 +00:00
scriptnum10.h Update links 2020-12-13 11:24:44 +02:00
scriptnum_tests.cpp Cosmetics in CScriptNum code and tests. 2020-10-01 00:34:31 +01:00
serialize_tests.cpp scripted-diff: Migrate from boost::optional to std::optional 2020-12-16 22:59:35 +00:00
sha256compress_tests.cpp
sighash_tests.cpp Update links 2020-12-13 11:24:44 +02:00
sigopcount_tests.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2020-11-23 23:07:15 +00:00
skiplist_tests.cpp Kill insecure_random and associated global state 2020-01-22 21:41:26 +00:00
streams_tests.cpp Replace uses of boost::filesystem with fs 2020-10-22 01:11:37 +01:00
test_bitcoin.cpp Remove init_and_check_sodium from crypto/common.h 2020-12-20 22:42:22 +00:00
test_bitcoin.h Replace uses of boost::filesystem with fs 2020-10-22 01:11:37 +01:00
test_random.h Update links 2020-12-13 11:24:44 +02:00
test_util.cpp scripted-diff: Remove #include <boost/foreach.hpp> 2020-11-23 23:07:15 +00:00
test_util.h
torcontrol_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
transaction_tests.cpp Add JSDescriptionInfo for constructing JSDescriptions 2020-12-20 22:42:22 +00:00
txvalidationcache_tests.cpp Auto merge of #4603 - nuttycom:ff/no_global_params, r=daira 2020-12-17 01:26:36 +00:00
uint256_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
univalue_tests.cpp Replace http with https: in links to the MIT license. 2019-07-18 15:26:01 +01:00
util_tests.cpp add a test case 2020-04-19 09:52:38 -03:00

README.md

Notes

The sources in this directory are unit test cases. Boost includes a unit testing framework, and since bitcoin already uses boost, it makes sense to simply use this framework rather than require developers to configure some other framework (we want as few impediments to creating unit tests as possible).

The build system is setup to compile an executable called "test_bitcoin" that runs all of the unit tests. The main source file is called test_bitcoin.cpp, which simply includes other files that contain the actual unit tests (outside of a couple required preprocessor directives). The pattern is to create one test file for each class or source file for which you want to create unit tests. The file naming convention is "<source_filename>_tests.cpp" and such files should wrap their tests in a test suite called "<source_filename>_tests". For an examples of this pattern, examine uint160_tests.cpp and uint256_tests.cpp.

Add the source files to /src/Makefile.test.include to add them to the build.

For further reading, I found the following website to be helpful in explaining how the boost unit test framework works: https://web.archive.org/web/20160304091452/http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/.

test_bitcoin has some built-in command-line arguments; for example, to run just the getarg_tests verbosely:

test_bitcoin --log_level=all --run_test=getarg_tests

... or to run just the doubledash test:

test_bitcoin --run_test=getarg_tests/doubledash

Run test_bitcoin --help for the full list.

bitcoin-util-test.py

The test directory also contains the bitcoin-util-test.py tool, which tests bitcoin utils (currently just bitcoin-tx). This test gets run automatically during the make check build process. It is also possible to run the test manually from the src directory:

test/bitcoin-util-test.py --srcdir=[current directory]