zcash-patched-for-explorer/src/test
Homu bc8221da81 Auto merge of #3089 - kozyilmaz:clang, r=str4d
[macOS] Fix test/gtest bugs caught by latest clang

Tests fail with latest clang on macOS (clang-900.0.39.2)

```
test/rpc_wallet_tests.cpp:1064:26: error: implicit conversion from 'double' to 'CAmount' (aka 'long long') changes value from 123.456 to 123 [-Werror,-Wliteral-conversion]
test/rpc_wallet_tests.cpp:1071:18: error: implicit conversion from 'double' to 'CAmount' (aka 'long long') changes value from 1.111 to 1 [-Werror,-Wliteral-conversion]
gtest/test_deprecation.cpp:28:1: error: control reaches end of non-void function [-Werror,-Wreturn-type]
```

Part of #2246.
2018-03-15 17:21:23 -07:00
..
data Regenerate sighash tests 2018-02-23 01:40:08 +00:00
Checkpoints_tests.cpp chainparams: move CCheckpointData into chainparams.h 2018-01-22 10:30:41 -05:00
DoS_tests.cpp Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter 2018-02-20 04:22:20 +00:00
Makefile
README.md
accounting_tests.cpp Refactor: replace calls to GetTxid() with GetHash() 2016-09-07 15:12:09 -07:00
addrman_tests.cpp Squashed commit of the following: 2018-03-02 11:45:05 +00:00
alert_tests.cpp Migrate Zcash-specific code to UniValue 2017-02-10 00:52:57 +00:00
allocator_tests.cpp
arith_uint256_tests.cpp
base32_tests.cpp
base58_tests.cpp [Univalue] add univalue over subtree 2017-02-10 02:18:51 +00:00
base64_tests.cpp
bctest.py
bignum.h Assert that new OpenSSL allocators succeed 2016-09-29 17:58:29 +13:00
bip32_tests.cpp extend bip32 tests to cover Base58c/CExtKey decode 2017-03-03 10:57:25 -08:00
bitcoin-util-test.py
bloom_tests.cpp Remove #1144 from bloom_tests by reverting to commit 5012190. 2016-09-07 15:12:09 -07:00
buildenv.py.in
checkblock_tests.cpp Skip JoinSplit verification before the last checkpoint 2016-12-09 21:06:45 +13:00
coins_tests.cpp Remove obsolete reference to CValidationState from UpdateCoins. 2018-02-20 04:22:18 +00:00
compress_tests.cpp
crypto_tests.cpp
equihash_tests.cpp Add compile flag to disable compilation of mining code 2017-01-30 21:14:46 +01:00
getarg_tests.cpp
hash_tests.cpp
key_tests.cpp Re-encode hard-coded addresses in tests 2016-10-03 23:53:14 -07:00
main_tests.cpp
mempool_tests.cpp Remove mempool transactions which commit to an unmineable branch ID 2018-02-20 02:57:44 +00:00
miner_tests.cpp Squashed commit of the following: 2018-03-02 11:45:05 +00:00
mruset_tests.cpp
multisig_tests.cpp Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter 2018-02-20 04:22:20 +00:00
netbase_tests.cpp
pmt_tests.cpp Refactor: replace calls to GetTxid() with GetHash() 2016-09-07 15:12:09 -07:00
policyestimator_tests.cpp Implement helper class for CTxMemPoolEntry constructor 2018-02-09 18:35:25 +00:00
pow_tests.cpp Update tests for new genesis blocks 2016-10-28 02:56:15 -07:00
raii_event_tests.cpp Skip RAII event tests if libevent is built without event_set_mem_functions 2017-03-24 09:03:59 +13:00
reverselock_tests.cpp c++11: don't throw from the reverselock destructor 2017-11-29 17:24:59 +00:00
rpc_tests.cpp Squashed commit of the following: 2018-03-02 11:45:05 +00:00
rpc_wallet_tests.cpp Auto merge of #3089 - kozyilmaz:clang, r=str4d 2018-03-15 17:21:23 -07:00
sanity_tests.cpp
scheduler_tests.cpp Update to address @daira comments wrt fixing configure.ac 2017-11-23 11:58:25 -05:00
script_P2SH_tests.cpp Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter 2018-02-20 04:22:20 +00:00
script_tests.cpp Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter 2018-02-20 04:22:20 +00:00
scriptnum_tests.cpp
serialize_tests.cpp
sha256compress_tests.cpp
sighash_tests.cpp Closes #2954 and #2959. Fixes Overwinter issues in sighash_tests. 2018-02-23 01:40:05 +00:00
sigopcount_tests.cpp
skiplist_tests.cpp
test_bitcoin.cpp Remove mempool transactions which commit to an unmineable branch ID 2018-02-20 02:57:44 +00:00
test_bitcoin.h Remove mempool transactions which commit to an unmineable branch ID 2018-02-20 02:57:44 +00:00
timedata_tests.cpp
torcontrol_tests.cpp Check that >3-digit octals are truncated. 2017-04-21 13:23:29 +12:00
transaction_tests.cpp Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter 2018-02-20 04:22:20 +00:00
uint256_tests.cpp
univalue_tests.cpp UniValue: don't escape solidus, keep espacing of reverse solidus 2017-03-02 13:23:03 -08:00
util_tests.cpp rpc: Accept scientific notation for monetary amounts in JSON 2017-02-10 02:18:58 +00: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/.