shrink method

  1. @override
Iterable<Shrinkable<Set<T>>> shrink()
override

Generates an Iterable of Shrinkables that fulfill the following criteria:

  • They are similar to this: They only differ in little ways.
  • They are simpler than this: The transitive hull is finite acyclic. If you would call shrink on all returned values and on the values returned by them etc., this process should terminate sometime.

Implementation

@core.override
core.Iterable<Shrinkable<core.Set<T>>> shrink() sync* {
  for (var i = 0; i < items.length; i++) {
    for (final item in items) {
      for (final shrunk in item.shrink()) {
        final newSet = core.Set.of(items)
          ..remove({item})
          ..add(shrunk);
        if (newSet.length >= minLength) {
          yield ShrinkableSet(newSet, minLength);
        }
      }
    }
  }
}