exercism / cpp

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

Reverse string task requires 2 files for tests to pass #687

Closed anton-ptashnik closed 11 months ago

anton-ptashnik commented 11 months ago

I solved the task in reverse_string.cpp and rebuilding with make produced output below:

/home/bman/Documents/dev/exercism/cpp/exercises/practice/reverse-string/reverse_string_test.cpp:10:35: error: ‘reverse_string’ is not a member of ‘reverse_string’; did you mean ‘reverse_string’?
   10 |     REQUIRE("" == reverse_string::reverse_string(""));
      |                                   ^~~~~~~~~~~~~~
/home/bman/Documents/dev/exercism/cpp/exercises/practice/reverse-string/reverse_string.h:4:11: note: ‘reverse_string’ declared here
    4 | namespace reverse_string {
      |           ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/reverse-string.dir/build.make:76: CMakeFiles/reverse-string.dir/reverse_string_test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/reverse-string.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

It appeared there is a header file reverse_string.h where I need to add a signature definition too. Tests passed locally then but failed on Exercism after publishing reverse_string.cpp with my solution. It appeared I need to publish both reverse_string.cpp and reverse_string.h for the solution to be accepted. It seems to be an extra complication and a user should be required to publish a cpp file only as it is done for other tasks like:

github-actions[bot] commented 11 months ago

Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link;%0D%0A%20%20%20%20%20%20%7C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5E~~~%0D%0A/home/bman/Documents/dev/exercism/cpp/exercises/practice/reverse-string/reverse_string.h:4:11:%20note:%20%E2%80%98reverse_string%E2%80%99%20declared%20here%0D%0A%20%20%20%204%20%7C%20namespace%20reverse_string%20%7B%0D%0A%20%20%20%20%20%20%7C%20%20%20%20%20%20%20%20%20%20%20%5E~~~%0D%0Amake%5B2%5D:%20%20%5BCMakeFiles/reverse-string.dir/build.make:76:%20CMakeFiles/reverse-string.dir/reverse_string_test.cpp.o%5D%20Error%201%0D%0Amake%5B1%5D:%20%20%5BCMakeFiles/Makefile2:85:%20CMakeFiles/reverse-string.dir/all%5D%20Error%202%0D%0Amake:%20***%20%5BMakefile:91:%20all%5D%20Error%202%0D%0A%60%60%60%0D%0A%0D%0AIt%20appeared%20there%20is%20a%20header%20file%20%60reverse_string.h%60%20where%20I%20need%20to%20add%20a%20signature%20definition%20too.%20Tests%20passed%20locally%20then%20but%20failed%20on%20Exercism%20after%20publishing%20%60reverse_string.cpp%60%20with%20my%20solution.%20It%20appeared%20I%20need%20to%20publish%20both%20reverse_string.cpp%20and%20reverse_string.h%20for%20the%20solution%20to%20be%20accepted.%0D%0AIt%20seems%20to%20be%20an%20extra%20complication%20and%20a%20user%20should%20be%20required%20to%20publish%20a%20cpp%20file%20only%20as%20it%20is%20done%20for%20other%20tasks%20like:%0D%0A-%20Log%20levels%20https://github.com/exercism/cpp/tree/main/exercises/concept/log-levels%0D%0A-%20Lasagna%20https://github.com/exercism/cpp/tree/main/exercises/concept/lasagna%0D%0A-%20Last%20will%20https://github.com/exercism/cpp/tree/main/exercises/concept/last-will&category=cpp) to copy this into a new topic there.


Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it.

siebenschlaefer commented 11 months ago

Hello Anton,

We prefer to have these discussions on the Forum, that's why this issue has been closed automatically.

As for this specific issue: The syllabus and its concept exercises are a relatively new addition to the C++ track, and one of the major difficulties was to structure them in a way each concept and concept exercise only deals with one or two aspects of the language. Therefore @vaeng decided to omit .h files (and I agree with that decision).
But in practice C++ programmers use .h files all the time, and all practice exercises on the C++ track here on Exercism do that, too. So it's the concept exercises that deviate, and I strongly believe that we should keep .h files in the practice exercises.

If you still think that we should remove .h files from some/all practice exercises, or if you want to contribute anything else, please post your ideas on the forum and try to reach a consensus.

Cheers!