mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-14 01:39:54 +01:00
44722f9ed3
This also goes for pkg-config installed by our CMake installation. This includes * Updating CMake version on Travis * Adding a `Catch2` subfolder to the `single_include/` folder to provide this include path both _inside_ the repository, and _outside_. * Updated examples to build with the new paths * Other general CMake cleanup
22 lines
633 B
C++
22 lines
633 B
C++
/*
|
|
* Created by Phil on 22/10/2010.
|
|
* Copyright 2010 Two Blue Cubes Ltd
|
|
*
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
*/
|
|
#define CATCH_CONFIG_MAIN
|
|
#include <catch2/catch.hpp>
|
|
|
|
unsigned int Factorial( unsigned int number ) {
|
|
return number > 1 ? Factorial(number-1)*number : 1;
|
|
}
|
|
|
|
TEST_CASE( "Factorials are computed", "[factorial]" ) {
|
|
REQUIRE( Factorial(0) == 1 );
|
|
REQUIRE( Factorial(1) == 1 );
|
|
REQUIRE( Factorial(2) == 2 );
|
|
REQUIRE( Factorial(3) == 6 );
|
|
REQUIRE( Factorial(10) == 3628800 );
|
|
}
|