NPDet
src
tools
tests
simple.cxx
Go to the documentation of this file.
1
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
2
#include "catch2/catch.hpp"
3
4
unsigned
int
Factorial
(
unsigned
int
number
) {
5
return
number
<= 1 ?
number
:
Factorial
(
number
-1)*
number
;
6
}
7
8
TEST_CASE
(
"Factorials are computed"
,
"[factorial]"
) {
9
REQUIRE(
Factorial
(1) == 1 );
10
REQUIRE(
Factorial
(2) == 2 );
11
REQUIRE(
Factorial
(3) == 6 );
12
REQUIRE(
Factorial
(10) == 3628800 );
13
}
TEST_CASE
TEST_CASE("Factorials are computed", "[factorial]")
Definition:
simple.cxx:8
Factorial
unsigned int Factorial(unsigned int number)
Definition:
simple.cxx:4
clipp::number
parameter number(const doc_string &label, Targets &&... tgts)
makes required, blocking value parameter; matches any string that represents a number
Definition:
clipp.h:2286
Generated by
1.8.18