Falsifiable (after 2 tests):
expected: Just 0
but got: Nothing
[()]
Positive {getPositive = 1}
-1
It has to be broken because a negative page or item (depending which function is being called - I can't actually tell) has to be invalid, and therefore a Nothing.
Well, if you want, I can test your solution on my local machine, then I might find out whether I made a mistake. I already fixed the test to also use the method you described ( :) ), but I don't think it changed much, the test cases run my code in a few ms.
It could also be your fibonacci solution, without sharing it can get very big.
Yes you are correct, I test it via brute force, which is not optimal. Surprisingly it passed with my solution, so I guess it is partially a problem of your definition. I updated the description, so you may want to take a look at the final hint!
Thanks for the feedback.
edit: I replaced it now, but I used the Small modifier from QuickCheck, which generates small numbers, e.g.: sample (Small <$> (arbitrary :: Gen Int)) results in values less than 20.
It was a problem with my solution. Fixed now. Thanks for the feedback.
You are absolutely right: fixed!
Also, now one should NEVER get an error even with egde random test cases in Python; working to do the same on Ruby.
Hey @code4food try it now, GiacomoSorbi has resolved them...:-)
Hey @GiacomoSorbi need your help over here.
The example is an example, it must be read:
"if percent of loss first month is 1, ...."
I modify this part and hopefully it will be clearer for you.
hitting the same issue
This is due to an error in the reference solution. I'll try to get it fixed, but I don't have write access on the tests anymore.
done.
I'm getting a similar error:
It has to be broken because a negative page or item (depending which function is being called - I can't actually tell) has to be invalid, and therefore a Nothing.
Well, if you want, I can test your solution on my local machine, then I might find out whether I made a mistake. I already fixed the test to also use the method you described ( :) ), but I don't think it changed much, the test cases run my code in a few ms.
It could also be your fibonacci solution, without sharing it can get very big.
Yes you are correct, I test it via brute force, which is not optimal. Surprisingly it passed with my solution, so I guess it is partially a problem of your definition. I updated the description, so you may want to take a look at the final hint!
Thanks for the feedback.
edit: I replaced it now, but I used the
Small
modifier from QuickCheck, which generates small numbers, e.g.:sample (Small <$> (arbitrary :: Gen Int))
results in values less than20
.The reference implementation returns -2 for those inputs. This contradicts the kata description, which claims
and