exercism/cpp/making-the-grade/HELP.md

3 KiB

Help

Running the tests

Running the tests involves running cmake -G and then using the build command appropriate for your platform. Detailed instructions on how to do this can be found on the Running the Tests page for C++ on exercism.org.

Passing the Tests

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. 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 line if defined(EXERCISM_RUN_ALL_TESTS) past the next test.

See the example below from the Bob exercise (file bob_test.cpp, line 15):

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

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.

Submitting your solution

You can submit your solution using the exercism submit making_the_grade.cpp command. This command will upload your solution to the Exercism website and print the solution page's URL.

It's possible to submit an incomplete solution which allows you to:

  • See how others have completed the exercise
  • Request help from a mentor

Need to get help?

If you'd like help solving the exercise, check the following pages:

Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.

To get help if you're having trouble, you can use one of the following resources: