-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximum call stack size exceeded with Test.fuzz2 #25
Comments
It's more likely #18, which was fixed in 1.1.0. Can you see if you're running that version? |
|
Okay. I would say it has something to do with your tiny float range but the RNG handles it fine: > Random.float -1.0e100 1.0e100
Generator <function> : Random.Generator Float
> gen = Random.float -1.0e100 1.0e100
Generator <function> : Random.Generator Float
> seed = Random.initialSeed 314159
Seed 135935125 1013904223 : Random.Seed
> Random.step gen seed
(-2.623217990942024e+99,Seed 4011486095 1013904223)
: ( Float, Random.Seed ) It might be trying to shrink a really small number and it fails? |
I added module Example exposing (suite)
import Expect exposing (Expectation)
import Fuzz exposing (Fuzzer, int, list, string)
import Test exposing (..)
suite : Test
suite =
fuzz2 Fuzz.float (Fuzz.floatRange -1.0e100 1.0e100) "should not run out of stack" <|
\a b ->
Expect.fail <| Debug.log "Fail with: a, b = " (String.fromFloat a ++ ", " ++ String.fromFloat b) The output is now:
I have run this a couple of times and the last log call is always |
Additionally: |
Tried to refresh my knowledge on decoders and got the same stack error for this exercise https://github.com/zwilias/elm-demystify-decoders/blob/master/src/Exercise07.elm I accidentally typed succeed "sure" instead of succeed "sure." and received. This is with default fuzz settings or with --fuzz 4
With --fuzz 3 everything works correctly
|
Any ideas? I'm getting this with lists-of-random-length: |
Can you (or someone) make a clone-able example to debug? |
https://ellie-app.com/4JSdnNjJxdBa1 |
By Also, we can replace the shrinker with |
Trimming it down a bit further: https://ellie-app.com/4JSRDc2sstqa1 So, maybe it's |
Can the bug be isolated from elm-test to only elm/random?
That makes sense since the test always passes (provided the value is generated successfully). |
@mgold Yes, it can: https://ellie-app.com/4Kv76dc7Hkpa1 |
That means I'll create a ticket in |
Great investigation on this! I'm encountering it in a couple projects. Any recommendations for avoiding it (It sounds like Is this the reference to a generator that would need a hard depth limit? That's a total shot in the dark: I was just hunting for a generator like the one referenced in the elm/random issue. |
No, that's only used to shrink values on failures, and the tree is lazy. I think it's a problem with fuzzers inherently. You need to be careful with |
This is no longer an issue on current |
SSCCE:
Expected
Test to fail
Actual
Notes
floatRange
tofloat
fixes this.The text was updated successfully, but these errors were encountered: