MCPcopy Create free account
hub / github.com/catchorg/Catch2 / Factorial

Function Factorial

examples/010-TestCase.cpp:13–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <catch2/catch_test_macros.hpp>
12
13static int Factorial( int number ) {
14 return number <= 1 ? number : Factorial( number - 1 ) * number; // fail
15// return number <= 1 ? 1 : Factorial( number - 1 ) * number; // pass
16}
17
18TEST_CASE( "Factorial of 0 is 1 (fail)", "[single-file]" ) {
19 REQUIRE( Factorial(0) == 1 );

Callers 1

010-TestCase.cppFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected