blob: 53fbc71a5953ff4623bfbc991d3c91b4c86692a0 [file] [log] [blame]
onqtam862a3bb2016-04-27 18:19:00 +03001#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
hardlyb1e7e142014-08-06 00:43:51 +03002#include "doctest.h"
3
onqtame4c75fc2016-05-21 01:24:48 +03004static int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; }
hardlyb1e7e142014-08-06 00:43:51 +03005
onqtame4c75fc2016-05-21 01:24:48 +03006TEST_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);
hardlyb1e7e142014-08-06 00:43:51 +030012}