Updated Tutorial (markdown)

philsquared
2012-06-02 09:33:15 -07:00
parent cfed5755dd
commit 88ec3e0c9c

@@ -34,7 +34,7 @@ To keep things simple we'll put everything in a single file.
return number <= 1 ? number : Factorial(number-1)*number;
}
TEST_CASE( "example/factorial", "The Factorial function should return the factorial of the number passed in" ) {
TEST_CASE( "example/factorial", "The Factorial function returns the factorial of the number passed in" ) {
REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 );
REQUIRE( Factorial(3) == 6 );
@@ -53,7 +53,7 @@ What is the bug? Well what is the factorial of zero?
Let's add that to the test case:
```C++
TEST_CASE( "example/factorial", "The Factorial function should return the factorial of the number passed in" ) {
TEST_CASE( "example/factorial", "The Factorial function returns the factorial of the number passed in" ) {
REQUIRE( Factorial(0) == 1 );
REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 );
@@ -65,7 +65,7 @@ Let's add that to the test case:
Now we get a failure - something like:
```
Example.cpp:291: Factorial(0) == 1 failed for: 0 == 1
Example.cpp:9: Factorial(0) == 1 failed for: 0 == 1
```
Note that we get the actual return value of Factorial(0) printed for us (0) - even though we used a natural expression with the == operator. That let's us immediately see what the problem is.