diff options
| author | Arnaud Bailly <arnaud.bailly@iohk.io> | 2025-01-25 11:15:05 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud.bailly@iohk.io> | 2025-01-25 11:15:05 +0100 |
| commit | a98aaf0232a159d403a7e2bc946c51c1fa490481 (patch) | |
| tree | 7f6eae9ad6381b31f5cec990bd7f4142b1073d8f /pbt/ts/src | |
| parent | 170a09b686c996e3985676b648cdfa619e971e47 (diff) | |
| download | lambda-nantes-a98aaf0232a159d403a7e2bc946c51c1fa490481.tar.gz | |
Start TS tiny PBT implementation
Diffstat (limited to 'pbt/ts/src')
| -rw-r--r-- | pbt/ts/src/index.ts | 20 |
1 files changed, 20 insertions, 0 deletions
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<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}; +} |
