forked from mirror/doctest
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
322 B
C++
15 lines
322 B
C++
#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);
|
|
}
|