diff --git a/exercises/shared/.docs/tests.md b/exercises/shared/.docs/tests.md index 0a1ad0d1..af9b10b7 100644 --- a/exercises/shared/.docs/tests.md +++ b/exercises/shared/.docs/tests.md @@ -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.