1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2024-11-01 05:05:23 +00:00
6502-cpp/test/tests.cpp

15 lines
325 B
C++

#include <catch2/catch.hpp>
unsigned int Factorial(unsigned int number)
{
return number <= 1 ? number : Factorial(number - 1) * number;
}
TEST_CASE("Factorials are computed", "[factorial]")
{
REQUIRE(Factorial(1) == 1);
REQUIRE(Factorial(2) == 2);
REQUIRE(Factorial(3) == 6);
REQUIRE(Factorial(10) == 3628800);
}