Revision a81c01d4f99cf9cd328cac6738fd86bfa9f6d7d6 authored by Martin Moene on 05 September 2018, 08:01:54 UTC, committed by Martin Hořeňovský on 08 September 2018, 09:05:52 UTC
1 parent 60b05b2
Raw File
MainTest.cpp
/*
 *  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 );
}
back to top