ptest 0.3.0 copy "ptest: ^0.3.0" to clipboard
ptest: ^0.3.0 copied to clipboard

A package to conduct property-based unit testing of Dart code.

example/main.dart

import 'package:ptest/ptest.dart';
import 'package:test/expect.dart';

// Example of a function to test.
int triple(int value) => value * 3;

void main() {
  pTest(
    'Returns value that is 3 times bigger than the input.',
    generateInput: (random) => random.integer(),
    body: (input) {
      // System Under Test.
      const sut = triple;

      final actual = sut(input);

      expect(actual, input * 3);
    },
  );
}
0
likes
140
points
227
downloads

Publisher

verified publishersevasnex.dev

Weekly Downloads

A package to conduct property-based unit testing of Dart code.

Repository (GitHub)
View/report issues

Topics

#testing #property-based-testing #fuzz-testing #random

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

meta, test, uuid

More

Packages that depend on ptest