Projects : bitcoin : bitcoin_dumpblock_no_losers

bitcoin/src/test/README

Dir - Raw

1The sources in this directory are unit test cases. Boost includes a
2unit testing framework, and since bitcoin already uses boost, it makes
3sense to simply use this framework rather than require developers to
4configure some other framework (we want as few impediments to creating
5unit tests as possible).
6
7The build system is setup to compile an executable called "test_bitcoin"
8that runs all of the unit tests. The main source file is called
9test_bitcoin.cpp, which simply includes other files that contain the
10actual unit tests (outside of a couple required preprocessor
11directives). The pattern is to create one test file for each class or
12source file for which you want to create unit tests. The file naming
13convention is "<source_filename>_tests.cpp" and such files should wrap
14their tests in a test suite called "<source_filename>_tests". For an
15examples of this pattern, examine uint160_tests.cpp and
16uint256_tests.cpp.
17
18For further reading, I found the following website to be helpful in
19explaining how the boost unit test framework works:
20
21http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/