Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
C:
bool
eans should be used instead ofchar
sconst
qualifiedfork fixing all (author gone)
I think that expected and actual lists were not matched in the test case in the c language. they might be good to swap each other.
C++ version generates warnings.
hello there! Can you explain to me how did you come out with that pattern ? (i mean the one stored in the array solver).
Right. I was not defensive enough when I was writing my solution ;-)
Do you really think this is an issue?
void solve(const char* input, char* result)
just tells you where to store your result.It's not unusual for output parameters to be uninitialized, e.g.
int int1; if (scanf("%d", &int1) == 1) // ...
Added it myself.
C version: the memory content inside
result
is not reset during the random tests, which means we have to reset them ourselves.I just fixed the issues but I have an additional suggestion for the C version.
The current error messages are not that helpful:
"The expression test_if_equal(result1, expected_result1) is false."
Why not this:
or put some of that into its own function and put it into the "Preloaded" section:
In the sample and final tests
do_test
can then be reduced to#define do_test(n) test_solve(input##n, expected_result##n)
.Fixed.
Fixed.
Fixed.
I don't think you really need that
using namespace std;
on the top ;-)C
Sample tests missing
#include <criterion/criterion.h>
test_if_equal
Loading more items...