• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #define CATCH_CONFIG_MAIN
2 
3 #include <catch2/catch.hpp>
4 
Factorial(int number)5 int Factorial( int number ) {
6     return number <= 1 ? 1 : Factorial( number - 1 ) * number;
7 }
8 
9 TEST_CASE( "Factorial Tests", "[single-file]" ) {
10     REQUIRE( Factorial(0) == 1 );
11     REQUIRE( Factorial(1) == 1 );
12     REQUIRE( Factorial(2) == 2 );
13     REQUIRE( Factorial(3) == 6 );
14     REQUIRE( Factorial(10) == 3628800 );
15 }