zcashd/src/test
Charlie O'Keefe 0ade29546f Save and restore current_path in TestingSetup constructor/destructor 2018-10-31 15:21:46 -06:00
..
data Add json test vectors for Sapling key components. 2018-06-13 10:38:32 -07:00
Checkpoints_tests.cpp
DoS_tests.cpp Part of #2966, extending Sprout tests to other epochs. 2018-04-09 16:17:30 -07:00
Makefile
README.md
accounting_tests.cpp
addrman_tests.cpp
alert_tests.cpp move rpc* to rpc/ 2018-07-18 11:07:16 -06:00
allocator_tests.cpp
arith_uint256_tests.cpp
base32_tests.cpp Simplify Base32 and Base64 conversions 2018-06-07 17:19:43 +12:00
base58_tests.cpp Split key_io (address/key encodings) off from base58 2018-05-08 21:39:56 +01:00
base64_tests.cpp Simplify Base32 and Base64 conversions 2018-06-07 17:19:43 +12:00
bctest.py cleanup: Ensure code is pyflakes-clean for CI 2018-03-27 02:47:57 +02:00
bech32_tests.cpp Raise the 90-character limit on Bech32 encodings 2018-07-30 16:01:22 +01:00
bignum.h
bip32_tests.cpp Split key_io (address/key encodings) off from base58 2018-05-08 21:39:56 +01:00
bitcoin-util-test.py Use portable #! in python scripts (/usr/bin/env) 2018-06-05 21:56:13 +12:00
bloom_tests.cpp Split key_io (address/key encodings) off from base58 2018-05-08 21:39:56 +01:00
buildenv.py.in Use portable #! in python scripts (/usr/bin/env) 2018-06-05 21:56:13 +12:00
checkblock_tests.cpp
coins_tests.cpp Rename Merkle Trees to include sprout or sapling 2018-08-01 10:31:09 -06:00
compress_tests.cpp
convertbits_tests.cpp Generalize ConvertBits 2018-06-07 17:19:34 +12:00
crypto_tests.cpp
dbwrapper_tests.cpp Get rid of nType and nVersion 2018-04-17 13:09:28 +01:00
equihash_tests.cpp
getarg_tests.cpp
hash_tests.cpp
key_tests.cpp wallet: Switch from SaplingSpendingKey to SaplingExtendedSpendingKey 2018-09-03 10:45:37 +01:00
main_tests.cpp
mempool_tests.cpp Closes #3134 - Least Authority Issue E 2018-04-10 20:45:36 -07:00
miner_tests.cpp Fix miner tests 2018-05-07 14:37:46 -06:00
mruset_tests.cpp
multisig_tests.cpp Part of #2966, extending Sprout tests to other epochs. 2018-04-09 16:17:30 -07:00
netbase_tests.cpp
pmt_tests.cpp [test] Remove unused code 2018-05-04 10:27:11 +01:00
policyestimator_tests.cpp
pow_tests.cpp
prevector_tests.cpp Prevector type 2018-04-16 07:38:36 -06:00
raii_event_tests.cpp
reverselock_tests.cpp
rpc_tests.cpp Allow passing branchId when calling signrawtransaction 2018-09-17 10:27:39 -06:00
rpc_wallet_tests.cpp Remove unnecessary call to IsValidPaymentAddress 2018-10-08 16:25:29 -06:00
sanity_tests.cpp
scheduler_tests.cpp
script_P2SH_tests.cpp Prevector type 2018-04-16 07:38:36 -06:00
script_tests.cpp Prevector type 2018-04-16 07:38:36 -06:00
scriptnum_tests.cpp
serialize_tests.cpp Replace boost::array with std::array 2018-05-26 00:12:57 +12:00
sha256compress_tests.cpp
sighash_tests.cpp Improve/Fix variable names 2018-06-09 20:27:35 -07:00
sigopcount_tests.cpp Prevector type 2018-04-16 07:38:36 -06:00
skiplist_tests.cpp
test_bitcoin.cpp Save and restore current_path in TestingSetup constructor/destructor 2018-10-31 15:21:46 -06:00
test_bitcoin.h Save and restore current_path in TestingSetup constructor/destructor 2018-10-31 15:21:46 -06:00
timedata_tests.cpp
torcontrol_tests.cpp
transaction_tests.cpp Rename Merkle Trees to include sprout or sapling 2018-08-01 10:31:09 -06:00
uint256_tests.cpp Get rid of nType and nVersion 2018-04-17 13:09:28 +01:00
univalue_tests.cpp
util_tests.cpp [test] Remove unused code 2018-05-04 10:27:11 +01: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: http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/.