A quick and dirty test with doctest. Should be good enough.
This commit is contained in:
parent
4365bfa98d
commit
fb5bf9d733
2 changed files with 16 additions and 0 deletions
11
tests/test1.cpp
Normal file
11
tests/test1.cpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include "doctest.h"
|
||||
|
||||
int factorial(int number) { return number <= 1 ? number : factorial(number - 1) * number; }
|
||||
|
||||
TEST_CASE("testing the factorial function") {
|
||||
CHECK(factorial(1) == 1);
|
||||
CHECK(factorial(2) == 2);
|
||||
CHECK(factorial(3) == 6);
|
||||
CHECK(factorial(10) == 3628800);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue