solidity/coder.decodeParam.js
Marek Kotewicz 1a137629e3 Squashed 'libjsqrc/ethereumjs/' changes from f8a43ed..c74c854
c74c854 version 0.3.2
9fa9cc7 fixed fixed size bytes encoding and decoding

git-subtree-dir: libjsqrc/ethereumjs
git-subtree-split: c74c854b56cb76bfc941d7aef8a135b7c1cfc4b3
2015-04-24 11:02:20 +02:00

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);
});
});
});
});