exercism / cpp

Exercism exercises in C++.
https://exercism.org/tracks/cpp
MIT License
257 stars 211 forks source link

Update tests.md with example #712

Closed Su24nn3 closed 1 year ago

Su24nn3 commented 1 year ago

Added example about where to find the line to move past the next test.

vaeng commented 1 year ago

Hello @apprentiLAB-Suzanne,

thanks for your PR. It is a good thing to show an actual file. The bob exercise might be unknown, so I would show it and not make the person search for the source code of the bob test. Probably something like:

To include the next test you have to move the line with if defined(EXERCISM_RUN_ALL_TESTS) past the desired test. See the example below from the Bob exercise:

-#if defined(EXERCISM_RUN_ALL_TESTS)
TEST_CASE("shouting")
{
REQUIRE("Whoa, chill out!" == bob::hey("WATCH OUT!"));
}
+#if defined(EXERCISM_RUN_ALL_TESTS)
Su24nn3 commented 1 year ago

Hi @vaeng, thanks for the suggestion, I updated the PR ! I kept "next test", instead of "desired test". I find that it might be simpler for beginners, if you prefer otherwise I can change it 🙂 Cheers