Skip to content

MapMutator clamps size range values #977

Closed

Description

@Marcono1234

MapMutator clamps the given min and max values:

this.minSize = Math.max(minSize, DEFAULT_MIN_SIZE);
this.maxSize = Math.min(maxSize, DEFAULT_MAX_SIZE);

This seems to differ from the other mutators such as ListMutator or ArrayMutator which use the given min and max values as is, and instead only perform validation using require(...).

Is it intended that MapMutator differs here in behavior? For consistency, would it make sense to use require here as well to impose restrictions (at least for the minSize)?

Activity

  1. added a commit that references this issue on Oct 15, 2025
    6924317
  2. simonresch commented on Oct 15, 2025

    @simonresch
    Contributor

    I don't see any reason why the MapMutatator should be treated differently. The minSize parameter is currently not being used

    require(minSize == 0, "@WithSize#min != 0 is not yet supported for Map");

    but the clamping of maxSize does not serve purpose that I can find. Without clamping maxSize it should be possible to mutate maps with more than DEFAULT_MAX_SIZE elements.

  3. added a commit that references this issue on Oct 15, 2025
    b9279ed
  4. added a commit that references this issue on Oct 16, 2025
    cb1fb37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions