summaryrefslogtreecommitdiff
path: root/pbt/ts/src/index.ts
blob: 3a71ccf563f7e8403183f1a9d4247fe4203f6c8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
type Result = 'OK' | 'Falsified' | 'Exception';

type TestResult<A> = {
  result: Result,
  seed: number,
  counterexample: A | null
};

type Predicate<A> = (a: A) => boolean;

type Gen<A> = (s: number) => (() => A);

type Shrinker<A> = (a: A) => [A];

function property<A>(seed: number,
  predicate: Predicate<A>,
  generator: Gen<A>,
  shrinker: Shrinker<A>): TestResult<A> {
  return {result: 'OK', seed, counterexample: null};
}