2015-04-22 06:55:24 +00:00
|
|
|
var chai = require('chai');
|
|
|
|
var assert = chai.assert;
|
|
|
|
var coder = require('../lib/solidity/coder');
|
2015-04-26 06:55:08 +00:00
|
|
|
var BigNumber = require('bignumber.js');
|
|
|
|
var bn = BigNumber;
|
2015-04-22 06:55:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
describe('lib/solidity/coder', function () {
|
2015-04-22 07:26:00 +00:00
|
|
|
describe('decodeParam', function () {
|
2015-04-26 06:55:08 +00:00
|
|
|
var test = function (t) {
|
|
|
|
it('should turn ' + t.value + ' to ' + t.expected, function () {
|
|
|
|
assert.deepEqual(coder.decodeParam(t.type, t.value), t.expected);
|
2015-04-22 06:55:24 +00:00
|
|
|
});
|
2015-04-26 06:55:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-07-27 20:38:33 +00:00
|
|
|
test({ type: 'address', expected: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
|
|
|
|
value: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1'});
|
|
|
|
test({ type: 'address[2]', expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
|
|
|
|
value: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' });
|
|
|
|
test({ type: 'address[]', expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
|
2015-07-21 09:35:52 +00:00
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
2015-07-27 20:38:33 +00:00
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' });
|
|
|
|
test({ type: 'address[2][]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
|
|
|
|
['0x407d73d8a49eeb85d32cf465507dd71d507100c3', '0x407d73d8a49eeb85d32cf465507dd71d507100c4']],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000040' +
|
|
|
|
'00000000000000000000000000000000000000000000000000000000000000a0' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' + /* 40 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' + /* 60 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c2' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' + /* a0 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c4' });
|
|
|
|
test({ type: 'address[][2]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
|
|
|
|
['0x407d73d8a49eeb85d32cf465507dd71d507100c3', '0x407d73d8a49eeb85d32cf465507dd71d507100c4']],
|
2015-06-25 10:40:03 +00:00
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
2015-07-27 20:38:33 +00:00
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' + /* 20 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c2' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c4' });
|
|
|
|
test({ type: 'address[][]', expected: [['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c2'],
|
|
|
|
['0x407d73d8a49eeb85d32cf465507dd71d507100c3', '0x407d73d8a49eeb85d32cf465507dd71d507100c4']],
|
2015-05-09 18:15:08 +00:00
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
2015-07-27 20:38:33 +00:00
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' + /* 20 */
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000080' +
|
|
|
|
'00000000000000000000000000000000000000000000000000000000000000e0' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' + /* 80 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' + /* a0 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c2' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' + /* e0 */
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c4' });
|
2015-07-28 07:01:05 +00:00
|
|
|
test({ type: 'bool', expected: true, value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'bool', expected: false, value: '0000000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
test({ type: 'bool[2]', expected: [true, false],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
test({ type: 'bool[]', expected: [true, true, false],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
|
2015-07-28 08:13:59 +00:00
|
|
|
test({ type: 'int', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'int', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'int', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'int', expected: new bn(-1), value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'});
|
|
|
|
test({ type: 'int256', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'int256', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'int256', expected: new bn(-1), value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'});
|
|
|
|
test({ type: 'int8', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'int32', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'int64', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'int128', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'int[]', expected: [], value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
test({ type: 'int[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003'});
|
|
|
|
test({ type: 'int256[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003'});
|
|
|
|
test({ type: 'int[]', expected: [new bn(1), new bn(2), new bn(3)],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003'});
|
|
|
|
test({ type: 'int[][3]', expected: [[new bn(1), new bn(2), new bn(3)], [new bn(4), new bn(5), new bn(6)]],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000004' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000005' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000006'});
|
2015-07-28 10:27:12 +00:00
|
|
|
|
|
|
|
test({ type: 'uint', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'uint', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'uint', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'uint', expected: new bn(-1), value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'});
|
|
|
|
test({ type: 'uint256', expected: new bn(1), value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
test({ type: 'uint256', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'uint256', expected: new bn(-1), value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'});
|
|
|
|
test({ type: 'uint8', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'uint32', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'uint64', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'uint128', expected: new bn(16), value: '0000000000000000000000000000000000000000000000000000000000000010'});
|
|
|
|
test({ type: 'uint[]', expected: [], value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
test({ type: 'uint[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003'});
|
|
|
|
test({ type: 'uint256[]', expected: [new bn(3)], value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003'});
|
|
|
|
test({ type: 'uint[]', expected: [new bn(1), new bn(2), new bn(3)],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003'});
|
|
|
|
test({ type: 'uint[][3]', expected: [[new bn(1), new bn(2), new bn(3)], [new bn(4), new bn(5), new bn(6)]],
|
|
|
|
value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000004' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000005' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000006'});
|
|
|
|
//test({ type: 'bytes32', expected: '0x6761766f66796f726b0000000000000000000000000000000000000000000000',
|
2015-07-27 20:38:33 +00:00
|
|
|
//test({ type: 'bytes32', expected: '0x6761766f66796f726b0000000000000000000000000000000000000000000000',
|
|
|
|
//value: '6761766f66796f726b0000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'bytes', expected: '0x6761766f66796f726b',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000009' +
|
|
|
|
//'6761766f66796f726b0000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'bytes32', expected: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
|
|
|
|
//value: '731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
|
|
|
|
////test({ type: 'bytes64', expected: '0xc3a40000c3a40000000000000000000000000000000000000000000000000000' +
|
|
|
|
////'c3a40000c3a40000000000000000000000000000000000000000000000000000',
|
|
|
|
////value: 'c3a40000c3a40000000000000000000000000000000000000000000000000000' +
|
|
|
|
////'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'bytes', expected: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
|
|
|
|
//test({ type: 'bytes', expected: '0x731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000040' +
|
|
|
|
//'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'731a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
|
|
|
|
//test({ type: 'bytes', expected: '0x131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000060' +
|
|
|
|
//'131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
|
|
|
|
//test({ type: 'string', expected: 'gavofyork', value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000009' +
|
|
|
|
//'6761766f66796f726b0000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'string', expected: 'ää',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000008' +
|
|
|
|
//'c383c2a4c383c2a4000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'string', expected: 'ü',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
//'c3bc000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'string', expected: 'Ã',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
//'c383000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'bytes', expected: '0xc3a40000c3a4',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000006' +
|
|
|
|
//'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'bytes32', expected: '0xc3a40000c3a40000000000000000000000000000000000000000000000000000',
|
|
|
|
//value: 'c3a40000c3a40000000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'bool', expected: true, value: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
//test({ type: 'bool', expected: false, value: '0000000000000000000000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ type: 'real', expected: new bn(1), value: '0000000000000000000000000000000100000000000000000000000000000000'});
|
|
|
|
//test({ type: 'real', expected: new bn(2.125), value: '0000000000000000000000000000000220000000000000000000000000000000'});
|
|
|
|
//test({ type: 'real', expected: new bn(8.5), value: '0000000000000000000000000000000880000000000000000000000000000000'});
|
|
|
|
//test({ type: 'real', expected: new bn(-1), value: 'ffffffffffffffffffffffffffffffff00000000000000000000000000000000'});
|
|
|
|
//test({ type: 'ureal', expected: new bn(1), value: '0000000000000000000000000000000100000000000000000000000000000000'});
|
|
|
|
//test({ type: 'ureal', expected: new bn(2.125), value: '0000000000000000000000000000000220000000000000000000000000000000'});
|
|
|
|
//test({ type: 'ureal', expected: new bn(8.5), value: '0000000000000000000000000000000880000000000000000000000000000000'});
|
|
|
|
//test({ type: 'address', expected: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',
|
|
|
|
//value: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1'});
|
|
|
|
//test({ type: 'string', expected: 'welcome to ethereum. welcome to ethereum. welcome to ethereum.',
|
|
|
|
//value: '0000000000000000000000000000000000000000000000000000000000000020' +
|
|
|
|
//'000000000000000000000000000000000000000000000000000000000000003e' +
|
|
|
|
//'77656c636f6d6520746f20657468657265756d2e2077656c636f6d6520746f20' +
|
|
|
|
//'657468657265756d2e2077656c636f6d6520746f20657468657265756d2e0000'});
|
2015-04-26 06:55:08 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('lib/solidity/coder', function () {
|
|
|
|
describe('decodeParams', function () {
|
|
|
|
var test = function (t) {
|
2015-04-26 08:51:32 +00:00
|
|
|
it('should turn ' + t.values + ' to ' + t.expected, function () {
|
2015-07-27 22:14:41 +00:00
|
|
|
assert.deepEqual(coder.decodeParams(t.types, t.values), t.expected);
|
2015-04-26 06:55:08 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-07-27 20:38:33 +00:00
|
|
|
test({ types: ['address'], expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1'],
|
|
|
|
values: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1'});
|
|
|
|
test({ types: ['address', 'address'], expected: ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0x407d73d8a49eeb85d32cf465507dd71d507100c3'],
|
|
|
|
values: '000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1' +
|
|
|
|
'000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c3'});
|
2015-07-28 07:01:05 +00:00
|
|
|
test({ types: ['bool[2]', 'bool[3]'], expected: [[true, false], [false, false, true]],
|
|
|
|
values: '0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000000' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000001'});
|
2015-07-28 08:13:59 +00:00
|
|
|
test({ types: ['int[2]', 'int256[3]'], expected: [[new bn(1), new bn(2)], [new bn(3), new bn(4), new bn(5)]],
|
|
|
|
values: '0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000004' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000005'});
|
|
|
|
test({ types: ['int'], expected: [new bn(1)], values: '0000000000000000000000000000000000000000000000000000000000000001'});
|
2015-07-28 10:27:12 +00:00
|
|
|
test({ types: ['uint[2]', 'uint256[3]'], expected: [[new bn(1), new bn(2)], [new bn(3), new bn(4), new bn(5)]],
|
|
|
|
values: '0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000004' +
|
|
|
|
'0000000000000000000000000000000000000000000000000000000000000005'});
|
|
|
|
test({ types: ['uint'], expected: [new bn(1)], values: '0000000000000000000000000000000000000000000000000000000000000001'});
|
|
|
|
//test({ types: ['bytes32', 'int'], expected: ['0x6761766f66796f726b0000000000000000000000000000000000000000000000', new bn(5)],
|
2015-07-27 22:14:41 +00:00
|
|
|
//test({ types: ['bytes32', 'int'], expected: ['0x6761766f66796f726b0000000000000000000000000000000000000000000000', new bn(5)],
|
|
|
|
//values: '6761766f66796f726b0000000000000000000000000000000000000000000000' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000005'});
|
|
|
|
//test({ types: ['int', 'bytes32'], expected: [new bn(5), '0x6761766f66796f726b0000000000000000000000000000000000000000000000'],
|
|
|
|
//values: '0000000000000000000000000000000000000000000000000000000000000005' +
|
|
|
|
//'6761766f66796f726b0000000000000000000000000000000000000000000000'});
|
|
|
|
//test({ types: ['int', 'string', 'int', 'int', 'int', 'int[]'], expected: [new bn(1), 'gavofyork', new bn(2), new bn(3), new bn(4),
|
|
|
|
//[new bn(5), new bn(6), new bn(7)]],
|
|
|
|
//values: '0000000000000000000000000000000000000000000000000000000000000001' +
|
|
|
|
//'00000000000000000000000000000000000000000000000000000000000000c0' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000002' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000004' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000100' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000009' +
|
|
|
|
//'6761766f66796f726b0000000000000000000000000000000000000000000000' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000005' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000006' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000007'});
|
|
|
|
//test({ types: ['int', 'bytes', 'int', 'bytes'], expected: [
|
|
|
|
//new bn(5),
|
|
|
|
//'0x131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
|
|
|
|
//new bn(3),
|
|
|
|
//'0x331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'431a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b',
|
|
|
|
//],
|
|
|
|
//values: '0000000000000000000000000000000000000000000000000000000000000005' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000080' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000003' +
|
|
|
|
//'00000000000000000000000000000000000000000000000000000000000000e0' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000040' +
|
|
|
|
//'131a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'231a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'0000000000000000000000000000000000000000000000000000000000000040' +
|
|
|
|
//'331a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b' +
|
|
|
|
//'431a3afc00d1b1e3461b955e53fc866dcf303b3eb9f4c16f89e388930f48134b'});
|
2015-04-22 06:55:24 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|