Possible bug in Dnd_Character

Hi, it seems as if there might be a bug in the test file for Dnd Character.

I’d submitted a solution some time ago, which passed ok. But today the same solution was giving me an error message.

I downloaded the exercise and once again it worked just fine. I changed the code a bit and it kept working. But, once I submitted the code, it failed here on exercism.org.

The error message I get is the following:

“/tmp/dnd-character/dnd_character_test.cpp:11:51: error: expected template-name before ‘<’ token
11 | class IsBetweenMatcher : public Catch::MatcherBase {
| ^
/tmp/dnd-character/dnd_character_test.cpp:11:51: error: expected ‘{’ before ‘<’ token
In file included from /usr/local/include/catch2/matchers/catch_matchers.hpp:11,
from /usr/local/include/catch2/matchers/catch_matchers_all.hpp:23,
from /usr/local/include/catch2/catch_all.hpp:126,
from /tmp/dnd-character/dnd_character_test.cpp:3:
/tmp/dnd-character/dnd_character_test.cpp: In function ‘void CATCH2_INTERNAL_TEST_32()’:
/tmp/dnd-character/dnd_character_test.cpp:95:50: error: class template argument deduction failed:
95 | CHECK_THAT(result, IsBetweenMatcher(3, 18));”

It seems there might be a problem with this class isBetweenMatcher, which is used in the test cases.

As it worked locally, perhaps it’s something on a header file.

That might have been caused by a change today (in which case I’m to blame.)

@vaeng Which version of Catch2 is installed in the test runner image?

Yes, I think that’s the problem. The CLI downloads version Catch2-2.13.6 where the tests compile without problems but the test runner uses Catch2-3.4.0 which has MatcherBase in a different namespace.

1 Like

I would love to switch to Catch2-3.4.0 for everything, but I have not yet been able to have a nice solution.

The old catch v2 versions comes with two files and is spammed into every exercise directory. The new version is spread over a multitude of headers, so you can pick whatever you need. But I do not want to have different files for every directory and have not been able to run the amalgamated files in a nice way to “emulate” the old file structure.

If anyone can figure it out I would be happy to use that!

(The test runner version is newer to support tags, which are needed to qualify for exercism’s v3 test-runner)

1 Like

Siebenschläfer found a simple fix. Thanks to you both @oxe-b, I made a PR.

2 Likes