zcashd/src/test
Daira Emma Hopwood bafc49e39e miner_tests.cpp improvements.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-20 15:46:56 +01:00
..
data Migrate to latest `zcash/librustzcash` revision 2022-03-23 02:05:06 +00:00
Checkpoints_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
DoS_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
Makefile
README.md Update links 2020-12-13 11:24:44 +02:00
addrman_tests.cpp Add assertions that `GetRandInt*` functions are called with `nMax >= 0`. 2023-04-19 22:48:46 +01:00
alert_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
allocator_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
arith_uint256_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
base32_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
base58_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
base64_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
bctest.py python: Use UTF-8 encodings for opened files 2021-04-14 13:19:33 +12:00
bech32_tests.cpp scripted-diff: Move util files to separate directory. 2022-07-01 17:50:09 -06:00
bip32_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
bitcoin-util-test.py Fix typos 2021-11-14 16:27:09 +02:00
bloom_tests.cpp zcashd release v5.3.3 2023-03-13 06:18:00 -06:00
buildenv.py.in Update #! env for python3 2020-02-10 13:34:29 -08:00
checkblock_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
checkqueue_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
coins_tests.cpp Make all CCoinsView methods pure-virtual. 2023-02-15 13:58:46 -07:00
compress_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
convertbits_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
crypto_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
cuckoocache_tests.cpp scripted-diff: Rename cuckoo tests' local rand context 2022-07-15 22:10:23 +00:00
dbwrapper_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
equihash_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
getarg_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
hash_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
key_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
limitedmap_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
main_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
mempool_tests.cpp [test] Remove priority from tests 2023-04-17 18:49:45 +01:00
merkle_tests.cpp Fix typos 2022-11-25 23:09:48 +02:00
miner_tests.cpp miner_tests.cpp improvements. 2023-04-20 15:46:56 +01:00
multisig_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
net_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
netbase_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
pmt_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
policyestimator_tests.cpp [test] Remove priority from tests 2023-04-17 18:49:45 +01:00
pow_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
prevector_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
raii_event_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
random_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
reverselock_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
rpc_tests.cpp Fix some messages, comments, and documentation that: 2023-04-17 18:49:45 +01:00
sanity_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
scheduler_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
script_P2PKH_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
script_P2SH_tests.cpp Make all CCoinsView methods pure-virtual. 2023-02-15 13:58:46 -07:00
script_standard_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
script_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
scriptnum10.h scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
scriptnum_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
serialize_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
sha256compress_tests.cpp
sighash_tests.cpp rust: Migrate Ed25519 FFI to `cxx` 2023-04-11 16:36:26 +00:00
sigopcount_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
skiplist_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
streams_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
sync_tests.cpp scripted-diff: Small locking rename 2022-05-14 01:25:08 +00:00
test_bitcoin.cpp [cleanup] Remove coin age priority completely. 2023-04-17 18:49:45 +01:00
test_bitcoin.h [test] Remove priority from tests 2023-04-17 18:49:45 +01:00
test_util.cpp Enrich zcash-cli arg conversion 2023-04-12 10:11:56 -06:00
test_util.h
torcontrol_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
transaction_tests.cpp Fix the dust threshold rate to three times 100 zats/1000 bytes. 2023-04-17 18:49:45 +01:00
txvalidationcache_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07:00
uint256_tests.cpp scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07: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 scripted-diff: Update Zcash copyrights to 2023 2023-01-23 11:31:54 -07: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]