Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions exercises/shared/.docs/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ Detailed instructions on how to do this can be found on the [Running the Tests][

## Passing the Tests

Get the first test compiling, linking and passing by following the [three rules of test-driven development][three-laws-of-tdd].
When you start a new exercise locally, the files are configured so that only the first test is performed.
Get that first test compiling, linking and passing by following the [three rules of test-driven development][three-laws-of-tdd].
Create just enough structure by declaring namespaces, functions, classes, etc., to satisfy any compiler errors and get the test to fail.
Then write just enough code to get the test to pass.
Once you've done that, uncomment the next test by moving the following line past the next test.
Once you've done that, uncomment the next test by moving the line `if defined(EXERCISM_RUN_ALL_TESTS)` past the next test.

```C++
#if defined(EXERCISM_RUN_ALL_TESTS)
See the example below from the Bob exercise (file `bob_test.cpp`, line 15):

```diff
-#if defined(EXERCISM_RUN_ALL_TESTS)
TEST_CASE("shouting")
{
REQUIRE("Whoa, chill out!" == bob::hey("WATCH OUT!"));
}
+#if defined(EXERCISM_RUN_ALL_TESTS)
```

This may result in compile errors as new constructs may be invoked that you haven't yet declared or defined.
Moving this line past the next test may result in compile errors as new constructs may be invoked that you haven't yet declared or defined.
Again, fix the compile errors minimally to get a failing test, then change the code minimally to pass the test, refactor your implementation for readability and expressiveness and then go on to the next test.

Try to use standard C++17 facilities in preference to writing your own low-level algorithms or facilities by hand.
Expand Down