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.
Sorry, I figured it out, but I was confused by empty arrays with nil and zero length
... this is exactly why I want test frameworks to use this wording instead: expected X but got Y
the wording used here makes sense when interacting with the test code, but the test code is hidden, it's the opposite of that. it should instead focus on presenting the result :s -- having the test read "expected Y" when in reality it expects X is just silly.
I'm not natan, but did you consider what happens to negative numbers when they're squared? :P
In your example, if you take the first number -95 and square it, you get 9025, which is not the smallest number at all... But it exists in 2nd array, just like all the other numbers.
@HarryTurney, I literally just saw the same problem on the previous post, and that one was in C++ . . .
so,
B1ts
is entirely right about the confusion that can occur when you are not aware of the actual input@natan
what exactly expected "false" in this case and what same it got "true" ??
I return "false", as expected, but test say I return "true"
Dude, it's literally the source of your bug, that's why I'm "stubborn" about it. Your conditional returns
false
for valid inputs, so you never print those test cases.By moving those print statements before the conditional, here's the last few lines of output that I see:
This is the failing test, not whatever you posted before. Does that make sense now? Or are you just gonna keep downvoting me and being convinced the kata is broken?
This comment is hidden because it contains spoiler information about the solution
Well then what is there on the next line after
func
?! It doesn't look like a print statement to me.This comment is hidden because it contains spoiler information about the solution
You're making a classic mistake of printing stuff NOT at the beginning of function. Your first
if
condition is not entirely correct, so you're not even seeing the test that actually failed.The tests are fine, not a kata issue.
This comment is hidden because it contains spoiler information about the solution
He's right, this fails in go.
[11 19 19 19 121 144 144 161]
[121 361 361 14641 20736 20736 25921 36100]
121 - 121
361 - 361
361 - 361
361 - 14641
False
3 19s but only 2 361s