Skip to content

Generators that generate unique values #173

Open
@zachdaniel

Description

@zachdaniel

At the moment, I see uniq_list_of/2 that allows for taking a generator and producing a unique list of items from that generator. But is there anything like maps |> uniq_by(&Map.take(&1, [:a, :b])) |> ... that ensures that no duplicate values are ever produced? It would need to also not reuse any values for shrinking, so perhaps would be unshrinkable (I'm out of my depth there).

What I'm looking for:

%{a: integer(), b: integer(), c: integer()}
|> fixed_map()
|> StreamData.uniq_by(&Map.take(&1, [:a, :b]))

The best I can find at the moment

%{a: integer(), b: integer(), c: integer()}
|> fixed_map()
|> StreamData.uniq_list_of(uniq_fun: &Map.take(&1, [:a, :b]))

The latter does not compose the way that I'm looking to compose the generator, as it produces lists.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions