From a98aaf0232a159d403a7e2bc946c51c1fa490481 Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Sat, 25 Jan 2025 11:15:05 +0100 Subject: Start TS tiny PBT implementation --- pbt/ts/src/index.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 pbt/ts/src/index.ts (limited to 'pbt/ts/src/index.ts') diff --git a/pbt/ts/src/index.ts b/pbt/ts/src/index.ts new file mode 100644 index 0000000..3a71ccf --- /dev/null +++ b/pbt/ts/src/index.ts @@ -0,0 +1,20 @@ +type Result = 'OK' | 'Falsified' | 'Exception'; + +type TestResult = { + result: Result, + seed: number, + counterexample: A | null +}; + +type Predicate = (a: A) => boolean; + +type Gen = (s: number) => (() => A); + +type Shrinker = (a: A) => [A]; + +function property(seed: number, + predicate: Predicate, + generator: Gen, + shrinker: Shrinker): TestResult { + return {result: 'OK', seed, counterexample: null}; +} -- cgit v1.2.3