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.
Go preloaded tests are not quite right. It doesn't correctly pick up the set variables
clues
andexpected
. I assume because the examples run after all lines of the Describe are evaluated, so the way it's done it only runs with last clues and examples. Could we move setting these variables inside theIt
?This comment is hidden because it contains spoiler information about the solution
This has confusing instructions. I don't mind the chessboard story or what's there but what's missing. There should be some explanation that you expect the results in a rational representation. It shouldn't be a guesswork that the returned array represents a rational number. I did go, and []int is not a natural way to express rationals.
ok admittedly I haven't read the instructions for other languages which have a hint. I rephrase the suggestion as mentioning this as a language independent requirement at the top.
kata hint != kata suggestion
Seems to be fixed.
Then why, in the test case with a set, the expected size of the set is 5?
first yielded value => {}
second yielded value => {0}
third yielded value => {0, 1}
fourth yielded value => {0, 1, 2}
fifth yielded value => {0, 1, 2, 3}
It yields 5 values and closes. Then why is the expected set {0, 1, 2, 3, 4}?
Error messages in javascript are useless:
same here:
expected 1 to equal 1
WTF is this in JS?Fixed test only tests queen promotion and en-passant by black.
Worse, random tests doesn't even test en-passant, so en-passant by white is never tested at all.
Square
andMove
should really be defined in Preloaded and not by user code.Is it really a requirement for parentheses to be acknowledged if the result doesn't change?
(ab)a
is the same regex asaba
(in this scenario).Why do the random tests expect
(ab)a
instead ofaba
?The random strings tests are borked - it expects nonempty results for clearly invalid expressions (eg. a trailing | ).
The solution is to just repeatedly attempt until the random strings pass... So I don't really see the point of these random string tests?
Bad "random_strings" test:
parse '(|(9?iXZVg"))' = '' shouldBe '(|(9?iXZVg"))'
You can see after the first
(
there is a|
. Empty string is not a valid regexp (in this kata), so''
is the correct result.Very (very very) nice kata :-)
Actually tried a lot of complex methods, at the end writing a dedidated simple parser gave the best results.
Note: had to write all the provided RegExp* methods, including the pretty print, for debugging in my MSVC...
If you have return, it is an explicit return which can be at any point in a method, but the last expression of any method is always returned as an implicit return, so no return is ever needed for the last expression in a Ruby method.
Loading more items...