dash/src/test
MarcoFalke 464a5e3c77
Merge #13282: trivial: Mark overrides as such.
60ebc7da4c trivial: Mark overrides as such. (Daniel Kraft)

Pull request description:

  This trivial change adds the `override` keyword to some methods that override virtual base class / interface methods.  This ensures that any future changes to the interface's method signatures which are not correctly mirrored in the subclasses will break at compile time with a clear error message, rather than at runtime.

Tree-SHA512: cc1bfa5f03b5e29d20e3eab07b0b5fa2f77b47f79e08263dbff43e4f463e9dd8f4f537e2c8c9b6cb3663220dcf40cfd77723cd9fcbd623c9efc90a4cd44facfc
2021-06-05 22:13:02 +03:00
..
data Merge #11423: [Policy] Several transaction standardness rules 2021-06-05 22:13:01 +03:00
addrman_tests.cpp Merge #16702: supplying and using asmap to improve IP bucketing 2021-05-20 00:05:09 +05:30
allocator_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
amount_tests.cpp
arith_uint256_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
base32_tests.cpp merge #19845: add support to (un)serialize as ADDRv2 2021-05-29 23:24:02 +03:00
base58_tests.cpp merge #17721: Don't allow Base58 decoding of non-Base58 strings. Add Base58 tests. 2021-05-28 11:39:24 +03:00
base64_tests.cpp
bech32_tests.cpp Merge #12881: Minor optimizations to bech32::Decode(); add tests. 2021-05-25 14:09:37 +03:00
bip32_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
bip39_tests.cpp
blockchain_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
blockencodings_tests.cpp partial merge #18317: Serialization improvements step 6 (all except wallet/gui) 2021-05-28 11:39:24 +03:00
blockfilter_tests.cpp
bloom_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
bls_tests.cpp tests: Add more unit tests for bls/bls.cpp (#4118) 2021-04-27 17:10:43 +03:00
bswap_tests.cpp
cachemap_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
cachemultimap_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
checkdatasig_tests.cpp
checkqueue_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
coins_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
compress_tests.cpp Merge #12752: Move compressor utility functions out of class 2021-04-18 17:10:05 -04:00
crypto_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
cuckoocache_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
dbwrapper_tests.cpp Merge pull request #4180 from UdjinM6/pre_pr4025_serialization 2021-05-29 23:23:19 +03:00
denialofservice_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
dip0020opcodes_tests.cpp
evo_deterministicmns_tests.cpp evo: Fix two mempool issues (#4154) 2021-05-14 12:55:03 -05:00
evo_simplifiedmns_tests.cpp
getarg_tests.cpp
governance_validators_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
hash_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
key_io_tests.cpp
key_tests.cpp
lcg.h
limitedmap_tests.cpp
main_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
Makefile
mempool_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
merkle_tests.cpp Partial #19326: Simplify hash.h interface using Spans 2021-05-20 10:15:17 +05:30
merkleblock_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
miner_tests.cpp merge #19845: add support to (un)serialize as ADDRv2 2021-05-29 23:24:02 +03:00
multisig_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
net_tests.cpp merge #19954: Complete the BIP155 implementation and upgrade to TORv3 2021-05-29 23:24:52 +03:00
netbase_tests.cpp merge #19954: Complete the BIP155 implementation and upgrade to TORv3 2021-05-29 23:24:52 +03:00
pmt_tests.cpp
policyestimator_tests.cpp Merge #13786: refactor: Avoid locking tx pool cs thrice 2021-02-04 14:58:13 -06:00
pow_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
prevector_tests.cpp
raii_event_tests.cpp
random_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
ratecheck_tests.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
README.md
reverselock_tests.cpp
rpc_tests.cpp Merge #12920: test: Fix sign for expected values 2021-04-17 16:22:01 -04:00
sanity_tests.cpp
scheduler_tests.cpp
script_p2pk_tests.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
script_p2pkh_tests.cpp
script_p2sh_tests.cpp
script_standard_tests.cpp Merge #13002: Do not treat bare multisig outputs as IsMine unless watched 2021-06-05 22:13:00 +03:00
script_tests.cpp Merge #11423: [Policy] Several transaction standardness rules 2021-06-05 22:13:01 +03:00
scriptnum10.h
scriptnum_tests.cpp
serialize_tests.cpp Other Dash-specific serializations 2021-05-28 12:31:13 +03:00
sighash_tests.cpp Merge #19373: Replace HexStr(o.begin(), o.end()) with HexStr(o) 2021-05-20 10:15:17 +05:30
sigopcount_tests.cpp
skiplist_tests.cpp
streams_tests.cpp
subsidy_tests.cpp Update copyright (#4115) 2021-04-20 22:33:02 +03:00
test_dash_fuzzy.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
test_dash_main.cpp
test_dash.cpp Merge #13023: Fix some concurrency issues in ActivateBestChain() 2021-06-05 22:13:02 +03:00
test_dash.h Merge #13023: Fix some concurrency issues in ActivateBestChain() 2021-06-05 22:13:02 +03:00
timedata_tests.cpp
torcontrol_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
transaction_tests.cpp Merge #11423: [Policy] Several transaction standardness rules 2021-06-05 22:13:01 +03:00
txindex_tests.cpp Merge #13033: Build txindex in parallel with validation 2021-05-25 13:48:04 +03:00
txvalidation_tests.cpp
txvalidationcache_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
uint256_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00
util_tests.cpp Merge pull request #4180 from UdjinM6/pre_pr4025_serialization 2021-05-29 23:23:19 +03:00
validation_block_tests.cpp Merge #13282: trivial: Mark overrides as such. 2021-06-05 22:13:02 +03:00
versionbits_tests.cpp Merge #13163: Make it clear which functions that are intended to be translation unit local 2021-05-25 14:09:36 +03:00

Compiling/running unit tests

Unit tests will be automatically compiled if dependencies were met in ./configure and tests weren't explicitly disabled.

After configuring, they can be run with make check.

To run the dashd tests manually, launch src/test/test_dash. To recompile after a test file was modified, run make and then run the test again. If you modify a non-test file, use make -C src/test to recompile only what's needed to run the dashd tests.

To add more dashd tests, add BOOST_AUTO_TEST_CASE functions to the existing .cpp files in the test/ directory or add new .cpp files that implement new BOOST_AUTO_TEST_SUITE sections.

To run the dash-qt tests manually, launch src/qt/test/test_dash-qt

To add more dash-qt tests, add them to the src/qt/test/ directory and the src/qt/test/test_main.cpp file.

Running individual tests

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

test_dash --log_level=all --run_test=getarg_tests

... or to run just the doubledash test:

test_dash --run_test=getarg_tests/doubledash

Run test_dash --help for the full list.

Note on adding test cases

The sources in this directory are unit test cases. Boost includes a unit testing framework, and since Dash Core 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_dash that runs all of the unit tests. The main source file is called test_dash.cpp. To add a new unit test file to our test suite you need to add the file to src/Makefile.test.include. 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 example of this pattern, examine uint256_tests.cpp.

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/.