Skip to content

Test failing with "too many consecutive elements were filtered out" #23

@IvanIvanoff

Description

@IvanIvanoff

When testing with this seed mix test --seed 33423 the following error occurs:

  1) test basic types tuple (StreamData.TypesTest)
     test/stream_data/types_test.exs:110
     ** (StreamData.FilterTooNarrowError) too many consecutive elements were filtered out.
      To avoid this:

       * make sure the generation space contains enough values that the chance of a generated
         value being filtered out is small. For example, don't generate all integers and filter
         out odd ones in order to have a generator of even integers (since you'd be taking out
         half the generation space).

       * keep an eye on how the generation size affects the generator being filtered. For
         example, you might be filtering out only a handful of values from the generation space,
         but small generation sizes might make the generation space much smaller hence increasing
         the probability of values that you'd filter out being generated.

       * try to restructure your generator so that instead of generating many values and taking
         out the ones you don't want, you instead generate values and turn all of them into
         values that are suitable. For example, multiply integers by two to have a generator of
         even values instead of filtering out all odd integers.


     code: check all x <- generator,
     stacktrace:
       test/stream_data/types_test.exs:115: anonymous fn/5 in StreamData.TypesTest."test basic types tuple"/1
       (stream_data) lib/stream_data/lazy_tree.ex:62: StreamData.LazyTree.filter_map/2
       (stream_data) lib/stream_data.ex:377: StreamData.bind_filter/5
       (stream_data) lib/stream_data.ex:348: anonymous fn/5 in StreamData.bind_filter/3
       (stream_data) lib/stream_data.ex:201: anonymous fn/3 in StreamData.bind_filter/5
       (stream_data) lib/stream_data/lazy_tree.ex:34: StreamData.LazyTree.map/2
       (stream_data) lib/stream_data.ex:381: StreamData.bind_filter/5
       (stream_data) lib/stream_data.ex:348: anonymous fn/5 in StreamData.bind_filter/3
       (stream_data) lib/stream_data.ex:201: StreamData.check_all/7
       test/stream_data/types_test.exs:113: (test)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions