[C++] Speedywagon seems to be buggy

Two things come to mind:

  • Single conceptual tasks are split across multiple Task fields (there are 13 tasks sections in the instructions, while in reality only four tasks are asked of the student).
  • Trying to pass the tests (online editor, canā€™t access CLI atm) I get this error:
Errors occurred during startup!
  Found an unclosed tag while registering test case 'alarm_control: works
  correctly for pointer' at /tmp/speedywagon/speedywagon_test.cpp:37
make[2]: *** [CMakeFiles/test_speedywagon.dir/build.make:70: CMakeFiles/test_speedywagon] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/test_speedywagon.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Errors occurred during startup!
  Found an unclosed tag while registering test case 'alarm_control: works
  correctly for pointer' at /tmp/speedywagon/speedywagon_test.cpp:37
make[2]: *** [CMakeFiles/test_speedywagon.dir/build.make:70: CMakeFiles/test_speedywagon] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/test_speedywagon.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Seems to be an issue with the tests?

Cheers!

I ran into this too. I believe the cause is likely to be the missing closing bracket on the line below:

Well, thatā€™s unhelpful. Line 37 of that test file, as per the error message, appears to be missing a ā€œ]ā€. :blush:

See Fixed missing closing tag for testcase.

That was my fault. I trusted our CI tools on github too much after an edit.
I made a PR to fix that problem shortly afterwards, but for the Cpp repository, I need another maintainer to review, before I can merge it.

Thanks to another PR, we can fix the bug, but not the formatting that I borked with incompatible markdown.

My co-maintainers are unavailable at the moment, so there was nothing I could do but wait and ping people :face_in_clouds:

Approved, though Iā€™m not actually familiar with C++ :grin:

2 Likes

Thanks for the approval, I was able to add my corrections.
The exercise is now working as intended. At least my test worked fine.

@NachoGoro, @renatalucia, @senarclens and @ambaiste., I hope it is okay to ping you. I think you solved the exercise already.
As I made up that exercise, it is not a very high standard of good or bad to solve it myself. So I am very interested to hear your thoughts about it.

Hi @vaeng,
thanks for asking. Iā€™m writing this from the top of my head, I sincerely hope that any contained criticism doesnā€™t come over as offensive.

First of all, I like the exercise (like I enjoy most exercises on exercism).

As I donā€™t yet know coding standards and guidelines used on exercism, feel free to dismiss the following if they are ok by exercismā€™s standards.

  • the line length of the README.md is fairly long and depending on the environment used, it might be easier to read if the lines were re-wrapped at a defined max. length
  • imho part of C++ greatness is that programmers are spared from using raw pointers most of the time; maybe adding a line or two in the README explaining that while pointers can be very useful, they can also cause serious trouble when used incorrectly might be a good improvement
  • you could consider recommending passing const pillar_men_sensor* whenever the the pointed to object isnā€™t changed; that would also mean adjusting uv_light_heuristic to expect a const pointer to vector

Either way Iā€™m very thankful for your addition to the C++ exercise collection and concepts!

Exercism uses one-sentence-per-line in the markdown files. The markdown files are rendered and displayed on the website; they arenā€™t meant to be read by users.

Iā€™ll leave the track-specific comments alone, since I donā€™t know C++ ;)

Thank you, itā€™s a pleasure to spread the knowledge. I will try to discuss your ideas. For the long sentences, it is my fault. The coding guideline for markdown has it on one line, but I make them long :smiley:

There are passages in the docs, to steer people away from pointers. I hope that would be enough :smiley:

There is a PR to implement a smart-pointer exercise. If you want to read the related teaching material, you can: Smart Pointers in C++ on Exercism. They have been online for a while, but I wanted to have a good raw-pointer exercise to have a progression.

Hi @vaeng.

For context, Iā€™m an experienced C++ engineer with a career dating back to using raw pointers in production code, and I thought the exercise was a fun little iteration and throwback. I think it was a little more ā€˜exploratoryā€™ in structure than many on exercism, and I would probably have prefered a 1:1 mapping of ā€œtaskā€ to function, but exploration is a useful learning tool and development is done better with a broad, holistic approach.

In terms of C++ pointer content itā€™s a good introduction I think. Perhaps a little more deliberate probing of pass-by-value vs pass-by-reference would benefit learners, but that could just as well form the meat of another follow-on exercise. Likewise the nullptr trap is a good fundamental, but it might be nice to build on it - perhaps something like a function which takes a pointer to an object, returns a reference to that object or throws an exception if its null (though exceptions are probably still controversial in the performance-critical code where you might consider using raw pointers). There are also the subtelties of const and pointers to explore in the future: the difference between T const, and T const for example. Raw pointers are in an interesting place in C++ these days, with smart pointers seemingly ubiquitous in real world use from what Iā€™ve seen.

Thanks for putting it together.

1 Like

Hi @vaeng !

I donā€™t have much to add to the already-given feedback :slight_smile:
Thanks for adding more stuff to the tracks!

1 Like