glados 0.0.1 copy "glados: ^0.0.1" to clipboard
glados: ^0.0.1 copied to clipboard

outdatedDart 1 only

🍰 A property-based testing framework that tries to break your invariances.

example/main.dart

import 'package:glados/src/glados.dart';
import 'package:test/test.dart';

int max(List<int> input) {
  if (input.isEmpty) return null;
  int max;
  for (var item in input) {
    max ??= item;
    if (item > max) {
      max = item;
    }
  }
  return max;
}

void main() {
  glados<List<int>>('maximum is in the list', (list) {
    var maximum = max(list);
    if (maximum == null) return;
    expect(list, contains(max(list)));
  });

  glados<List<int>>('maximum is only null if the list is empty', (list) {
    if (max(list) == null) {
      expect(list, isEmpty);
    }
  });

  glados<List<int>>('maximum is >= all items', (list) {
    var maximum = max(list);
    if (maximum != null) {
      for (var item in list) {
        expect(maximum, greaterThanOrEqualTo(item));
      }
    }
  });
}
37
likes
0
pub points
56%
popularity

Publisher

unverified uploader

🍰 A property-based testing framework that tries to break your invariances.

License

unknown (license)

Dependencies

test

More

Packages that depend on glados