Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
020-TestCase-2.cpp File Reference
#include <catch2/catch.hpp>
Include dependency graph for 020-TestCase-2.cpp:

Go to the source code of this file.

Functions

int Factorial (int number)
 
 TEST_CASE ("2: Factorial of 0 is 1 (fail)", "[multi-file:2]")
 
 TEST_CASE ("2: Factorials of 1 and higher are computed (pass)", "[multi-file:2]")
 

Function Documentation

◆ Factorial()

int Factorial ( int number)

Definition at line 7 of file 020-TestCase-2.cpp.

7 {
8 return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
9// return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass
10}
int Factorial(int number)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TEST_CASE() [1/2]

TEST_CASE ( "2: Factorial of 0 is 1 (fail)" ,
"" [multi-file:2] )

Definition at line 12 of file 020-TestCase-2.cpp.

12 : Factorial of 0 is 1 (fail)", "[multi-file:2]" ) {
13 REQUIRE( Factorial(0) == 1 );
14}
void multi(const bn::CurveParam &cp)
Definition sample.cpp:224
Here is the call graph for this function:

◆ TEST_CASE() [2/2]

TEST_CASE ( "2: Factorials of 1 and higher are computed (pass)" ,
"" [multi-file:2] )

Definition at line 16 of file 020-TestCase-2.cpp.

16 : Factorials of 1 and higher are computed (pass)", "[multi-file:2]" ) {
17 REQUIRE( Factorial(1) == 1 );
18 REQUIRE( Factorial(2) == 2 );
19 REQUIRE( Factorial(3) == 6 );
20 REQUIRE( Factorial(10) == 3628800 );
21}
Here is the call graph for this function: