Example_test.cpp 343 B

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