mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
1a137629e3
c74c854 version 0.3.2 9fa9cc7 fixed fixed size bytes encoding and decoding git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: c74c854b56cb76bfc941d7aef8a135b7c1cfc4b3
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
var chai = require('chai');
|
|
var assert = chai.assert;
|
|
var coder = require('../lib/solidity/coder');
|
|
|
|
var tests = [
|
|
{ type: 'int', value: '0000000000000000000000000000000000000000000000000000000000000001', expected: 1},
|
|
{ type: 'int', value: '0000000000000000000000000000000000000000000000000000000000000010', expected: 16},
|
|
{ type: 'int', value: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', expected: -1},
|
|
{ type: 'bytes32', value: '6761766f66796f726b0000000000000000000000000000000000000000000000', expected: 'gavofyork'},
|
|
{ type: 'bytes', value: '0000000000000000000000000000000000000000000000000000000000000009' +
|
|
'6761766f66796f726b0000000000000000000000000000000000000000000000', expected: 'gavofyork'}
|
|
];
|
|
|
|
describe('lib/solidity/coder', function () {
|
|
describe('decodeParam', function () {
|
|
tests.forEach(function (test) {
|
|
it('should turn ' + test.value + ' to ' + test.expected, function () {
|
|
assert.equal(coder.decodeParam(test.type, test.value), test.expected);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|