You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ### Compiling/running unit tests
  2. Unit tests will be automatically compiled if dependencies were met in `./configure`
  3. and tests weren't explicitly disabled.
  4. After configuring, they can be run with `make check`.
  5. To run the starwelsd tests manually, launch `src/test/test_starwels`.
  6. To add more starwelsd tests, add `BOOST_AUTO_TEST_CASE` functions to the existing
  7. .cpp files in the `test/` directory or add new .cpp files that
  8. implement new BOOST_AUTO_TEST_SUITE sections.
  9. To run the starwels-qt tests manually, launch `src/qt/test/test_starwels-qt`
  10. To add more starwels-qt tests, add them to the `src/qt/test/` directory and
  11. the `src/qt/test/test_main.cpp` file.
  12. ### Running individual tests
  13. test_starwels has some built-in command-line arguments; for
  14. example, to run just the getarg_tests verbosely:
  15. test_starwels --log_level=all --run_test=getarg_tests
  16. ... or to run just the doubledash test:
  17. test_starwels --run_test=getarg_tests/doubledash
  18. Run `test_starwels --help` for the full list.
  19. ### Note on adding test cases
  20. The sources in this directory are unit test cases. Boost includes a
  21. unit testing framework, and since starwels already uses boost, it makes
  22. sense to simply use this framework rather than require developers to
  23. configure some other framework (we want as few impediments to creating
  24. unit tests as possible).
  25. The build system is setup to compile an executable called `test_starwels`
  26. that runs all of the unit tests. The main source file is called
  27. test_starwels.cpp. To add a new unit test file to our test suite you need
  28. to add the file to `src/Makefile.test.include`. The pattern is to create
  29. one test file for each class or source file for which you want to create
  30. unit tests. The file naming convention is `<source_filename>_tests.cpp`
  31. and such files should wrap their tests in a test suite
  32. called `<source_filename>_tests`. For an example of this pattern,
  33. examine `uint256_tests.cpp`.
  34. For further reading, I found the following website to be helpful in
  35. explaining how the boost unit test framework works:
  36. [http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/](http://www.alittlemadness.com/2009/03/31/c-unit-testing-with-boosttest/).