diff --git a/test/coder.encodeParam.js b/test/coder.encodeParam.js index 9b5502a..0110eac 100644 --- a/test/coder.encodeParam.js +++ b/test/coder.encodeParam.js @@ -95,52 +95,52 @@ describe('lib/solidity/coder', function () { //expected: '731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'}); //test({ type: 'bytes32', value: '0x02838654a83c213dae3698391eabbd54a5b6e1fb3452bc7fa4ea0dd5c8ce7e29', //expected: '02838654a83c213dae3698391eabbd54a5b6e1fb3452bc7fa4ea0dd5c8ce7e29'}); - //test({ type: 'bytes', value: '0x6761766f66796f726b', - //expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000009' + - //'6761766f66796f726b0000000000000000000000000000000000000000000000'}); - //test({ type: 'bytes', value: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b', - //expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000020' + - //'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'}); - //test({ type: 'string', value: 'gavofyork', expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000009' + - //'6761766f66796f726b0000000000000000000000000000000000000000000000'}); - //test({ type: 'bytes', value: '0xc3a40000c3a4', - //expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000006' + - //'c3a40000c3a40000000000000000000000000000000000000000000000000000'}); + test({ type: 'bytes', value: '0x6761766f66796f726b', + expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000009' + + '6761766f66796f726b0000000000000000000000000000000000000000000000'}); + test({ type: 'bytes', value: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b', + expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000020' + + '731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'}); + test({ type: 'string', value: 'gavofyork', expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000009' + + '6761766f66796f726b0000000000000000000000000000000000000000000000'}); + test({ type: 'bytes', value: '0xc3a40000c3a4', + expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000006' + + 'c3a40000c3a40000000000000000000000000000000000000000000000000000'}); //test({ type: 'bytes32', value: '0xc3a40000c3a4', //expected: 'c3a40000c3a40000000000000000000000000000000000000000000000000000'}); //test({ type: 'bytes64', value: '0xc3a40000c3a40000000000000000000000000000000000000000000000000000' + //'c3a40000c3a40000000000000000000000000000000000000000000000000000', //expected: 'c3a40000c3a40000000000000000000000000000000000000000000000000000' + //'c3a40000c3a40000000000000000000000000000000000000000000000000000'}); - //test({ type: 'string', value: 'ää', - //expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000008' + - //'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'}); - //test({ type: 'string', value: 'ü', - //expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000002' + - //'c3bc000000000000000000000000000000000000000000000000000000000000'}); - //test({ type: 'string', value: 'Ã', - //expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000002' + - //'c383000000000000000000000000000000000000000000000000000000000000'}); - //test({ type: 'int[]', value: [], expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000000'}); - //test({ type: 'int[]', value: [3], expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000001' + - //'0000000000000000000000000000000000000000000000000000000000000003'}); - //test({ type: 'int256[]', value: [3], expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000001' + - //'0000000000000000000000000000000000000000000000000000000000000003'}); - //test({ type: 'int[]', value: [1,2,3], expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000003' + - //'0000000000000000000000000000000000000000000000000000000000000001' + - //'0000000000000000000000000000000000000000000000000000000000000002' + - //'0000000000000000000000000000000000000000000000000000000000000003'}); + test({ type: 'string', value: 'ää', + expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000008' + + 'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'}); + test({ type: 'string', value: 'ü', + expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000002' + + 'c3bc000000000000000000000000000000000000000000000000000000000000'}); + test({ type: 'string', value: 'Ã', + expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000002' + + 'c383000000000000000000000000000000000000000000000000000000000000'}); + test({ type: 'int[]', value: [], expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000000'}); + test({ type: 'int[]', value: [3], expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000001' + + '0000000000000000000000000000000000000000000000000000000000000003'}); + test({ type: 'int256[]', value: [3], expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000001' + + '0000000000000000000000000000000000000000000000000000000000000003'}); + test({ type: 'int[]', value: [1,2,3], expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000003' + + '0000000000000000000000000000000000000000000000000000000000000001' + + '0000000000000000000000000000000000000000000000000000000000000002' + + '0000000000000000000000000000000000000000000000000000000000000003'}); @@ -235,9 +235,9 @@ describe('lib/solidity/coder', function () { //test({ types: ['bytes32'], values: ['0x6761766f66796f726b'], //test({ types: ['bytes32'], values: ['0x6761766f66796f726b'], //expected: '6761766f66796f726b0000000000000000000000000000000000000000000000'}); - //test({ types: ['string'], values: ['gavofyork'], expected: '0000000000000000000000000000000000000000000000000000000000000020' + - //'0000000000000000000000000000000000000000000000000000000000000009' + - //'6761766f66796f726b0000000000000000000000000000000000000000000000'}); + test({ types: ['string'], values: ['gavofyork'], expected: '0000000000000000000000000000000000000000000000000000000000000020' + + '0000000000000000000000000000000000000000000000000000000000000009' + + '6761766f66796f726b0000000000000000000000000000000000000000000000'}); //test({ types: ['bytes32', 'int'], values: ['0x6761766f66796f726b', 5], //expected: '6761766f66796f726b0000000000000000000000000000000000000000000000' +