summaryrefslogtreecommitdiff
path: root/pbt/ts/src
diff options
context:
space:
mode:
Diffstat (limited to 'pbt/ts/src')
-rw-r--r--pbt/ts/src/index.test.ts9
-rw-r--r--pbt/ts/src/index.ts10
2 files changed, 13 insertions, 6 deletions
diff --git a/pbt/ts/src/index.test.ts b/pbt/ts/src/index.test.ts
new file mode 100644
index 0000000..deb55ec
--- /dev/null
+++ b/pbt/ts/src/index.test.ts
@@ -0,0 +1,9 @@
+import Prando from 'prando';
+import { prop_reverse_with_two_lists } from './index';
+
+describe('testing lists reversal', () => {
+ test('reverse of two appended lists is append of each list reversed', () => {
+ let reverse_append_result = prop_reverse_with_two_lists(new Prando(Math.random() * 1000), 0);
+ expect(reverse_append_result).toBe(true);
+ });
+});
diff --git a/pbt/ts/src/index.ts b/pbt/ts/src/index.ts
index 1e9b8c0..cb7fd6e 100644
--- a/pbt/ts/src/index.ts
+++ b/pbt/ts/src/index.ts
@@ -47,7 +47,7 @@ function shrink2lists<A>([l1, l2]: [A[], A[]]): [A[], A[]][] {
return result;
}
-let prop_reverse_with_two_lists =
+export let prop_reverse_with_two_lists =
property<[number[], number[]]>(reverse_with_two_lists, gen2lists(someInt), shrink2lists);
let prop_reverse_is_self_inverse =
@@ -57,8 +57,6 @@ async function main() {
let rng = new Prando(Math.random() * 1000);
let reverse_append_result = prop_reverse_with_two_lists(rng, 0);
let reverse_reverse_result = prop_reverse_is_self_inverse(rng, 0);
- console.log('result: ' + JSON.stringify(reverse_append_result));
- console.log('result: ' + JSON.stringify(reverse_reverse_result));
-}
-
-main();
+ console.log('reverse_append_result: ' + JSON.stringify(reverse_append_result));
+ console.log('reverse_reverse_result: ' + JSON.stringify(reverse_reverse_result));
+};