Move readFirst4 to LibBytes

This commit is contained in:
Amir Bandeali
2018-05-22 07:39:21 -07:00
parent 326a566db2
commit d4aacd218a
5 changed files with 53 additions and 39 deletions

View File

@@ -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);
});
});
});