1
0
mirror of https://github.com/lefticus/6502-cpp.git synced 2025-07-20 17:24:06 +00:00

change name to 6502-c++ and merge in files from cpp_starter_project

This commit is contained in:
Jason Turner
2021-05-06 14:04:59 -06:00
parent 21d23dfcb9
commit 4ffae19177
19 changed files with 1064 additions and 61 deletions

14
test/constexpr_tests.cpp Normal file
View File

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