Changeset View
Changeset View
Standalone View
Standalone View
doc/unit-tests.md
Show All 37 Lines | |||||
one test file for each class or source file for which you want 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` | unit tests. The file naming convention is `<source_filename>_tests.cpp` | ||||
and such files should wrap their tests in a test suite | and such files should wrap their tests in a test suite | ||||
called `<source_filename>_tests`. For an example of this pattern, | called `<source_filename>_tests`. For an example of this pattern, | ||||
examine `uint256_tests.cpp`. | examine `uint256_tests.cpp`. | ||||
For further reading, I found the following website to be helpful in | For further reading, I found the following website to be helpful in | ||||
explaining how the boost unit test framework works: | explaining how the boost unit test framework works: | ||||
[http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/](http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/). | [https://legalizeadulthood.wordpress.com/2009/07/04/c-unit-tests-with-boost-test-part-1/](https://legalizeadulthood.wordpress.com/2009/07/04/c-unit-tests-with-boost-test-part-1/) | ||||
### Debugging unit tests | ### Debugging unit tests | ||||
Simple example of debugging unit tests with GDB on Linux: | Simple example of debugging unit tests with GDB on Linux: | ||||
``` | ``` | ||||
cd /build/src/test | cd /build/src/test | ||||
gdb test_bitcoin | gdb test_bitcoin | ||||
break interpreter.cpp:295 # No path is necessary, just the file name and line number | break interpreter.cpp:295 # No path is necessary, just the file name and line number | ||||
Show All 13 Lines |