From 599113da83b61d1eab9e65f9d38d9b0fee5acc3b Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 23 Mar 2021 13:30:10 +0100 Subject: [PATCH] Add more ordering tests --- packages/amino/src/multisig.spec.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/amino/src/multisig.spec.ts b/packages/amino/src/multisig.spec.ts index 05134891..42bd1869 100644 --- a/packages/amino/src/multisig.spec.ts +++ b/packages/amino/src/multisig.spec.ts @@ -16,6 +16,12 @@ describe("multisig", () => { expect(compareArrays(new Uint8Array([5, 5, 5]), new Uint8Array([5, 5]))).toBeGreaterThan(0); expect(compareArrays(new Uint8Array([5, 5, 5]), new Uint8Array([5]))).toBeGreaterThan(0); expect(compareArrays(new Uint8Array([5, 5, 5]), new Uint8Array([]))).toBeGreaterThan(0); + + // left or right precedence + expect(compareArrays(new Uint8Array([5, 5, 4]), new Uint8Array([4, 5, 5]))).toBeGreaterThan(0); + + // magnitude is more important than length + expect(compareArrays(new Uint8Array([6]), new Uint8Array([5, 5]))).toBeGreaterThan(0); }); it("return < 0 for left < right", () => { @@ -25,6 +31,12 @@ describe("multisig", () => { expect(compareArrays(new Uint8Array([5, 5]), new Uint8Array([5, 5, 5]))).toBeLessThan(0); expect(compareArrays(new Uint8Array([5]), new Uint8Array([5, 5, 5]))).toBeLessThan(0); expect(compareArrays(new Uint8Array([]), new Uint8Array([5, 5, 5]))).toBeLessThan(0); + + // left or right precedence + expect(compareArrays(new Uint8Array([4, 5, 5]), new Uint8Array([5, 5, 4]))).toBeLessThan(0); + + // magnitude is more important than length + expect(compareArrays(new Uint8Array([5, 5]), new Uint8Array([6]))).toBeLessThan(0); }); it("can be used with sort", () => {