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++ tests can generate an index of 0. This is outside the defined range.
Added a couple fixed cases with the full alphabet, lower and upper case, as well as more punctuation. Copied the same cases to my other translations.
Yes. If the predicate is only expecting 1 arg, then the 2nd one will be ignored. The
NULL
is just a placeholder. Depending on the calling convention, stack or registers, you'll end up with an unusedNULL
ptr on the stack or a zeroed out register that's ignored. A problem does arise when you pass too few parameters and the callee tries to use uninitialized garbage data.Of course, this is all dependent on the user calling the reentrant version with a two-arg predicate, and the non-reentrant version with either a one-arg predicate or a two-arg predicate that handles
NULL
correctly. You could write a single two-arg predicate that functions as a one-arg version depending on the 2nd arg's value, then use that for both reentrant and non-reentrant applications.If you haven't yet, take a look at variable arguments handling in C (stdarg.h). The initial parameter(s) must be strictly defined, as they tell the function how many additional parameters are passed, and potentially how to interpret them. See the
printf
family of functions. I know that whilejavac
verifies all the parameters passed toString.format
, I've never seen a C compiler parse the format string. It's done at run-time.Added an empty string test case to my translations. Broke two C solutions and four Java solutions with the change. People, come on! :-P
The JavaScript test framework breaks when fed an empty string, so I'll leave that to the original author. Not touching the other languages.
Java, C++, C, and Perl translations available. Please review.
Understood, here's what it'll print now.
I'll update my Perl and NASM translations accordingly.
Done. The message looks like this:
Java, Perl, and NASM translations available. Please review.
solution
function can be called by the user, allowing the tests to be passed with this, "auto quarter_of = [](int month){return solution(month);};
". You need to either move this logic into theGet_quarter
method, makesolution
a method of theRandom_tests
class, or declaresolution
to bestatic
so it's not accessible from outside the testing framework.{
is cuddled, other times it's on the next line. Sometimes indentation is 2 spaces, and other times it's 4.Java, C, C++, and Perl translations available. Please review.
Well
replace
would reduce the number of characters before thesplit
, resulting in a shorter array forfilter
to spin through. Since each array element is a string, then fewerString
objects are created.C and C++ translations. Please review.
@Unnamed, forked.
@Unnamed, I've forked the C translation. Once it's approved I'll fork this one.
@Unnamed, try the forked version.
Loading more items...