erikerlandson / st_tree

A fast and flexible c++ template class for tree data structures
https://github.com/erikerlandson/st_tree/wiki
Apache License 2.0
95 stars 20 forks source link

Add an option for testing #21

Closed emmenlau closed 4 years ago

emmenlau commented 4 years ago

This PR adds a separate option ENABLE_TESTS, default On, to enable or disable tests.

erikerlandson commented 4 years ago

@emmenlau sorry I did not see these PRs!

Is enable_testing() a cmake function?

emmenlau commented 4 years ago

Hi, yes enable_testing() is a cmake function (see https://cmake.org/cmake/help/latest/command/enable_testing.html) that adds additional functionality helpful for tests. A better description of what it does is actually given here: https://stackoverflow.com/a/50469013/7200132

emmenlau commented 4 years ago

Admittedly, I did not describe this PR very well. It adds the cmake option to enable or disable testing. But additionally, it defines a target that can be invoked i.e. via make test (or whatever build system you use, ninja test etcetc...) to execute the tests.

erikerlandson commented 4 years ago

Cool! can you write up brief instructions / example here on these PR comments, so I can update the wiki? Like "here's example of disabling testing, here's the new make test command, and running tests, etc"

emmenlau commented 4 years ago

Here is an idea for the documentation, is that good?

The default is to build tests. In order to disable building the tests, use the cmake option ENABLE_TESTS, i.e. disable with cmake -DENABLE_TESTS=OFF or set ENABLE_TESTS to OFF in the graphical cmake interface. When tests are enabled, they can be executed with the test target. For example, when using the Makefile cmake generator, tests can be executed with make test.