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.
I was bored so I copied your code and added a print statement near the end. Before converting from float to int, it printed something like
59.9999999999...
, the expected result was60
and your int was59
. If done on paper, those inputs indeed should return60.0000000...
or60
, so the programmed function doesn't match the description. I'm no programming guru but I think its a case of one of those small changes that sometimes happens when using floats. So your solution is correct except for the occasional "off by one" -error caused by floating point calculation. My hint is to reduce the number of floating point operations one way or another.Input String: ArUYAqjuAuqrujAqAju.
Random Test => assertion failed:
(left == right)
left:1023145616406514156
, right:1023145212402514152
My calculation yielded the value on the right.
In this case 'U' and 'u' do not share the same digit in the expected value(left). One is 2 and the other 6.
All test folowing same pattern:
assert_eq!(expected, convert(s));
even random one.For the random test
expected
value is calculated when it is needed.If you believe your solution is right please post here the values you geting: input string, expected value and your calculated value (dont forget mark post as spoiler).
Without knowing thouse values I can't check if here is an issue with the test.
Thanks for your report.
Awesome, thanks for the nice kata!
Fixed.
Fixed.
@hobovsky
I've fixed that(I think you are talking about swapping of actual and expected), if you think that's not the case please give me an example.
Edit: Reference solution and description was inconsistent, I gave priority to description and changed the reference solution, now this should be fine in Java.
It is true, I already confirmed the issue below. There are two problems in Java:
These two factors make debugging of the kata really fun.
I'm pretty sure that's not true, but if it is, could you provide an example of such input and what's expected value?
The test fails in JAVA with mixed case because this is not true:
In reality the test wants different number from same letter UPPER/lower case
Eg. A->1 ; a->2
Yes, the problem is with actual and expected values, where same letters do not share the same digit regardless of case
Which language?
Help us help you.
When I run the random tests, I print my result in the console.
Then it says I fail but the string I printed in the console does not match the output it says I failed.
My print result: 1021234035000340607
Message: "Input was: wLrwraYlaFLlLaYlclK,
excpected: 1021234035000340607,
but was: 1021234536050345758 ==>
expected: <1021234035000340607>
but was: <1021234536050345758>""
Is the problem that actual and expected values are switched in the test asserts?
This can make for surreal failure messages. It's also easy to diagnose and easy to fix, without all the "I think .." and "Maybe ..".
If you are going to post an
Issue
, in general, you should be sure it's actually a kata issue, which means you pretty much have to know what the problem is.I am doing this Kata in Rust and i think there is a problem with the Random tests.
The random test keeps failing but when I test the input string with my soulution it gives the expected answer.
Maybe there is a difference between the test string and the expected string ??
Loading more items...