From bff8a2b2dbb3a63aaf661678513612e6ca69e2e5 Mon Sep 17 00:00:00 2001 From: Michael Maurer Date: Mon, 13 Feb 2017 09:54:25 -0800 Subject: [PATCH] New test cases for packing multiple arguments --- test/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/index.js b/test/index.js index c9af43f..1c62908 100644 --- a/test/index.js +++ b/test/index.js @@ -490,6 +490,17 @@ describe('solidity tight packing int16', function () { }) }) +describe('solidity tight packing multiple arguments', function () { + it('should equal', function () { + var a = abi.solidityPack( + [ 'bytes32', 'uint32', 'uint32', 'uint32', 'uint32' ], + [ new Buffer('123456', 'hex'), 6, 7, 8, 9 ] + ) + var b = '123456000000000000000000000000000000000000000000000000000000000000000006000000070000000800000009' + assert.equal(a.toString('hex'), b.toString('hex')) + }) +}) + describe('solidity tight packing sha3', function () { it('should equal', function () { var a = abi.soliditySHA3( @@ -501,6 +512,17 @@ describe('solidity tight packing sha3', function () { }) }) +describe('solidity tight packing sha3 #2', function () { + it('should equal', function () { + var a = abi.soliditySHA3( + [ 'bytes32', 'uint32', 'uint32', 'uint32', 'uint32' ], + [ new Buffer('123456', 'hex'), 6, 7, 8, 9 ] + ) + var b = '1f2eedb6c2ac3e4b4e4c9f7598e626baf1e15a4e848d295479f46ec85d967cba' + assert.equal(a.toString('hex'), b.toString('hex')) + }) +}) + describe('solidity tight packing sha256', function () { it('should equal', function () { var a = abi.soliditySHA256(