blob: 61d2889cf6c60b3d1aa4b7823879803ee613913f [file] [log] [blame]
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
int fact(int n) {
return n <= 1 ? n : fact(n - 1) * n;
}
TEST_CASE("testing the factorial function") {
CHECK(fact(0) == 1); // should fail
CHECK(fact(1) == 1);
CHECK(fact(2) == 2);
CHECK(fact(3) == 6);
CHECK(fact(10) == 3628800);
}