From d4aacd218a4fdb1876ac656e04fcccdb892a9395 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 22 May 2018 07:39:21 -0700 Subject: Move readFirst4 to LibBytes --- packages/contracts/test/libraries/lib_bytes.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages/contracts/test/libraries/lib_bytes.ts') diff --git a/packages/contracts/test/libraries/lib_bytes.ts b/packages/contracts/test/libraries/lib_bytes.ts index ce3adbdae..fc28c363b 100644 --- a/packages/contracts/test/libraries/lib_bytes.ts +++ b/packages/contracts/test/libraries/lib_bytes.ts @@ -248,4 +248,12 @@ describe('LibBytes', () => { it('should fail if the length between the offset and end of the byte array is too short to hold a uint256)', async () => {}); }); */ + + describe('readFirst4', () => { + it('should return the first 4 bytes of a byte array of arbitrary length', async () => { + const first4Bytes = libBytes.publicReadFirst4.callAsync(byteArrayLongerThan32Bytes); + const expectedFirst4Bytes = byteArrayLongerThan32Bytes.slice(0, 10); + expect(first4Bytes).to.equal(expectedFirst4Bytes); + }); + }); }); -- cgit v1.2.3