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