Testing

From Medusa: Coordinate Free Mehless Method implementation
Revision as of 16:59, 1 November 2016 by Jureslak (talk | contribs)

Jump to: navigation, search

All library code is tested by means of unit tests. Unit tests provide verification, are good examples and prevent regressions.

Basic usage

Tests can be run all at once via make run_all_tests or individually via eg. make basisfunc_run_tests.

Each header file should be accompanied by a <util_name>_test.cpp with examples for all functionalities and unit tests.

Tests are written in Google test framework:

1 TEST(Group, Name) {
2     EXPECT_EQ(a, b);
3 }

Compiled binary supports running only specified test. Use ./main --gtest_filter=Domain* for filtering and ./main --help for more options.

Before pushing run ./util/run_tests.sh. This script makes and executes all <util_name>_test.cpp test files, checks coding style and documentation. You can check them separately as well.

1 Usage: ./run_tests.sh
2 Options:
3   -c   run only configuration
4   -t   run only tests
5   -s   run only stylechecks
6   -d   run only docscheck
7   -h   print this help
8 Example:
9  ./run_tests.sh -sd

If anything is wrong you will get pretty little red error, but if you see green, you're good to go.

Philosophy behind testing

TO DO: JURE