summaryrefslogtreecommitdiff
path: root/pbt/ts/src/index.ts
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud.bailly@iohk.io>2025-01-25 11:15:05 +0100
committerArnaud Bailly <arnaud.bailly@iohk.io>2025-01-25 11:15:05 +0100
commita98aaf0232a159d403a7e2bc946c51c1fa490481 (patch)
tree7f6eae9ad6381b31f5cec990bd7f4142b1073d8f /pbt/ts/src/index.ts
parent170a09b686c996e3985676b648cdfa619e971e47 (diff)
downloadlambda-nantes-a98aaf0232a159d403a7e2bc946c51c1fa490481.tar.gz
Start TS tiny PBT implementation
Diffstat (limited to 'pbt/ts/src/index.ts')
-rw-r--r--pbt/ts/src/index.ts20
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};
+}