|
||||
File indexing completed on 2025-01-30 10:30:43
0001 #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file 0002 #include "catch2/catch.hpp" 0003 0004 unsigned int Factorial( unsigned int number ) { 0005 return number <= 1 ? number : Factorial(number-1)*number; 0006 } 0007 0008 TEST_CASE( "Factorials are computed", "[factorial]" ) { 0009 REQUIRE( Factorial(1) == 1 ); 0010 REQUIRE( Factorial(2) == 2 ); 0011 REQUIRE( Factorial(3) == 6 ); 0012 REQUIRE( Factorial(10) == 3628800 ); 0013 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |