@muesli4 you are right when saying engineers have to write tests themselves when facing new tasks to solve.
But you must understand that CW purpose is to teach new concepts: a kata must guide players in order to solve it and this is done by giving explicit examples.
Current tests are just cryptic and bring nothing at all to help warriors.
Moreover they are misleading. Huffman encoding is a compression algorithm: its purpose is to compress a text.
What can a player understand by reading test.assert_equals( len(encode( fs, "aaaabcc" )), 10 )? Output of this function is longer than the original string! Completely counter-intuitive...
Please provide explicit test cases: even if it is possible to generate several outputs, it is possible to check if it belongs to a set and to provide this set in examples.
Wow!
When I see this quality of code and compare it to my solution with 8 "ifs" I feel like shit!
Very clever with the regex to discard any edge cases. I used 4 if statements if 0 was being evaluated. Sheesh
I got a long way to go.
Haha was just dropping in to leave this comment.
Good one :)
Very simple and clear. Tnku;)
This comment is hidden because it contains spoiler information about the solution
Wow! Great solution. Everything looks so simple. :D
This comment is hidden because it contains spoiler information about the solution
nevermind, I just scrolled down and saw somebody submitted this already. It was fun to learn about regex to come up with this on my own though.
This comment is hidden because it contains spoiler information about the solution
.
Fixed
I read again the description: I think that you should put emphasis on this point:
@muesli4
you are right when saying engineers have to write tests themselves when facing new tasks to solve.But you must understand that CW purpose is to teach new concepts: a kata must guide players in order to solve it and this is done by giving explicit examples.
Current tests are just cryptic and bring nothing at all to help warriors.
Moreover they are misleading. Huffman encoding is a compression algorithm: its purpose is to compress a text.
What can a player understand by reading
test.assert_equals( len(encode( fs, "aaaabcc" )), 10 )
? Output of this function is longer than the original string! Completely counter-intuitive...Please provide explicit test cases: even if it is possible to generate several outputs, it is possible to check if it belongs to a set and to provide this set in examples.
Loading more items...