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.
This comment is hidden because it contains spoiler information about the solution
From the instructions:
In the instructions, it states that the
getChunk
function exposed by the reader "Returns at least one char".One of the test cases, the first chunk received by the parse method is an empty string (so the entire string it was reading must be an empty string), thus making the charCount, wordCount, and lineCount expected to be 0.
Even if it was allowed that the first string received by
getChunk
was an empty string, there are other tests where there are empty lines that count as a line, so wouldn't an empty string test case still have alineCount
of 1?Example:
and if that's the case, then shouldn't this be true:
Is this a bug or did I just misunderstood something?
I tried to console.log the output within parse() and it seems like I get correct char, word, and line counts (on the initial test case: "Once upon a time")
This error shows upon Test (not on submit)
Appreciate any feedback :)
I found the introduction of
.reset
method a bit misleading. I thought.reset
method would serve some specific purpose (like resetting the values during calculating something etc.), but it turns out.reset
doesn't actually "reset" anything, it merely declares and initializes the three properties to value 0. Seems like there's no need to "reset" anything in this kata. I was thinking there's something wrong with my solutions as they didn't make any "resetting" use of the method. Other Codewarriors' solutions don't make use of it either (apart from just declaring and initializing the three properties). Introducing.reset
method only created unnecessary confusion imo, it should have been omitted or named differently (e.g..initialCounts
).Also, I'd would be nice to state in kata description whether we're allowed to modify the code in
.reset
method and inReader
constructor.This comment is hidden because it contains spoiler information about the solution
No random tests.