diff options
| author | Terry Truong <terry06890@gmail.com> | 2023-01-21 13:47:28 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2023-01-21 13:47:28 +1100 |
| commit | bf357e48dc261dab08598bd93071ca53ef386402 (patch) | |
| tree | 826d1cd1cb8d14fe65293c8efaa97b7e7622c876 /tests/rbtree.test.ts | |
| parent | 0a9b2c2e5eca8a04e37fbdd423379882863237c2 (diff) | |
Adjust frontend coding style
Diffstat (limited to 'tests/rbtree.test.ts')
| -rw-r--r-- | tests/rbtree.test.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/rbtree.test.ts b/tests/rbtree.test.ts index 5b2bc34..edb3135 100644 --- a/tests/rbtree.test.ts +++ b/tests/rbtree.test.ts @@ -3,6 +3,7 @@ import {RBTree, Iterator, rbtree_shallow_copy} from '/src/rbtree.ts' function cmpInt(a: int, b: int){ return a - b; } + function getIteratorEls<T>(itr: Iterator<T>): T[]{ let els: T[] = []; if (itr.data() != null){ @@ -14,6 +15,7 @@ function getIteratorEls<T>(itr: Iterator<T>): T[]{ } return els; } + function getIteratorElsRev<T>(itr: Iterator<T>): T[]{ let els: T[] = []; if (itr.data() != null){ @@ -40,6 +42,7 @@ test('insert and remove', () => { expect(tree.min()).toBe(-1); expect(tree.max()).toBe(20); }); + test('iteration', () => { let vals = [10, 10, 20, 5, -1]; let tree = new RBTree(cmpInt); @@ -51,6 +54,7 @@ test('iteration', () => { sorted.reverse() expect(getIteratorElsRev(tree.iterator())).toEqual(sorted); }); + test('find', () => { let tree = new RBTree(cmpInt); tree.insert(1); |
