onqtam | b8220c5 | 2017-05-16 00:21:15 +0300 | [diff] [blame] | 1 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN |
2 | #include "doctest.h" | ||||
3 | |||||
4 | static int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; } | ||||
5 | |||||
6 | TEST_CASE("testing the factorial function") { | ||||
7 | CHECK(factorial(0) == 1); | ||||
8 | CHECK(factorial(1) == 1); | ||||
9 | CHECK(factorial(2) == 2); | ||||
10 | CHECK(factorial(3) == 6); | ||||
11 | CHECK(factorial(10) == 3628800); | ||||
12 | } |