deno.land / x / replicache@v10.0.0-beta.0 / array-compare.test.ts

array-compare.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import {expect} from '@esm-bundle/chai';import {arrayCompare} from './array-compare';
test('array compare', () => { const t = <T>(a: ArrayLike<T>, b: ArrayLike<T>, expected: number) => { expect(arrayCompare(a, b)).to.equal(expected); expect(arrayCompare(b, a)).to.equal(-expected); };
t([], [], 0); t([1], [1], 0); t([1], [2], -1); t([1, 2], [1, 2], 0); t([1, 2], [1, 3], -1); t([1, 2], [2, 1], -1); t([1, 2, 3], [1, 2, 3], 0); t([1, 2, 3], [2, 1, 3], -1); t([1, 2, 3], [2, 3, 1], -1); t([1, 2, 3], [3, 1, 2], -1); t([1, 2, 3], [3, 2, 1], -1);
t([], [1], -1); t([1], [1, 2], -1); t([2], [1, 2], 1);});
replicache

Version Info

Tagged at
2 years ago