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.
Please check my fork. The issue of many tests expecting 0 is because the available ingredients are not guaranteed to include the ingredients from the recipe. This seems to be the case in Python and maybe other languages as well. Anyway, I did fix it by making sure that half the time the available ingredients include a random sample from the recipe. "half the time" can be easily modified to be any other desired fraction.
limits.h
should beclimits
Preloaded
snippt, they should be present in every snippet which needs themAssert::That(actual, Equals(exp), "example #1");
- custom messages do not work this way. They should be provided withExtraMessage
(see here) or similar message supplier. Interesting fact, random tests got this right :) They are also not really necessary in example tests, maybe just remove them.0
.Oh you're right :facepalm:
*(const int*)a - *(const int*)b;
is subject to underflow though, so it's not safe to compare largeint
with that expressionIssues:
const
(i.e.const int* arr1
andconst int* arr2
). Currently, the user solution and reference not only destroy inputs (which is kind of a nonsense for this kind of task, as this kind of problem can be perfectly solved just by reading values without modifying them), but also they get in a way of each other, because a user solution is called first, it potentially modifies the input array, and then the reference solution is called with destroyed arrays.stdio.h
is not necessary.Suggestions:
cr_assert(actual, "the actual value cannot be NULL");
can becr_assert_not_null(actual, "the actual value cannot be NULL");
_compare_ints
could be justreturn *(const int*)a - *(const int*)b;
This comment is hidden because it contains spoiler information about the solution