[QuickCheck] uncaught exception: SomeAsyncException (stack overflow) (after 3 tests and 3 shrinks)
Boris Rozinov
borisrozinov at yahoo.ca
Sun Apr 17 14:45:23 BST 2016
Sorry Nick and thanks a lot
Boris
From: Nick Smallbone <nicsma at chalmers.se>
To: Boris Rozinov <borisrozinov at yahoo.ca>
Cc: "quickcheck at projects.haskell.org" <quickcheck at projects.haskell.org>
Sent: Sunday, April 17, 2016 9:43 AM
Subject: Re: [QuickCheck] uncaught exception: SomeAsyncException (stack overflow) (after 3 tests and 3 shrinks)
Hi Boris,
The uncaught exception is because your function crashes for negative
numbers. Try multBy (-1) 0 in GHCi and you will get the same result.
Nick
On Saturday 16 April, 2016 at 04:02 pm, Boris Rozinov wrote:
>
> multBy:: (Eq a, Integral a) => a -> a -> a
> multBy 0 _ = 0
> multBy 1 n = n
> multBy m n = n+ multBy (m-1) n
>
> multByI::Integer->Integer->Integer
> multByI i1 i2= i1*i2
>
> --works fine:
> it "x*y(i) is always eq to y*x" $ do
> property $ (\x y -> (multByI x y) == (multByI y x::Integer) )
>
>
> --but this one gives error:
> it "x*y is always eq to y*x" $ do
> property $ (\x y -> (multBy (x::Integer) (y::Integer)) == (multBy (y::Integer) (x::Integer)) )
>
>
> Addition.hs:32:
> 1) Addition x*y is always eq to y*x
> uncaught exception: SomeAsyncException (stack overflow) (after 3 tests and 3 shrinks)
> 0
> -1
>
> Randomized with seed 1748887214
>
> Finished in 92.4021 seconds
> 12 examples, 1 failure
> *** Exception: ExitFailure 1
>
> Thanks, Boris
>
>
> _______________________________________________
> QuickCheck mailing list
> QuickCheck at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/quickcheck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/quickcheck/attachments/20160417/611eab40/attachment.htm>
More information about the QuickCheck
mailing list