metamon/transform/dict

Standard Transform(Dict(k, v)) constructors used in metamorphic relations. The classic use case is asserting that a function is invariant under key reordering: f(shuffle_keys(d)) == f(d).

Values

pub fn insert(
  key: k,
  value: v,
) -> transform.Transform(dict.Dict(k, v))

Insert / overwrite the binding key -> value.

pub fn remove(key: k) -> transform.Transform(dict.Dict(k, v))

Delete key from the dict if present.

pub fn shuffle_keys(
  seed_value: Int,
) -> transform.Transform(dict.Dict(k, v))

Re-insert all entries in a deterministically shuffled order. The resulting dict is ==-equal to the input (since Dict ignores insertion order), but any consumer that observes traversal order will see a different sequence — exactly the property metamorphic tests want to catch.

Search Document