Skip to content

Commit

Permalink
New test cases for packing multiple arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmau committed Feb 13, 2017
1 parent a0c8545 commit bff8a2b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit bff8a2b

Please sign in to comment.