2015-04-22 08:55:24 +02:00
|
|
|
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}
|
|
|
|
];
|
|
|
|
|
|
|
|
describe('lib/solidity/coder', function () {
|
2015-04-22 09:26:00 +02:00
|
|
|
describe('decodeParam', function () {
|
2015-04-22 08:55:24 +02:00
|
|
|
tests.forEach(function (test) {
|
|
|
|
it('should turn ' + test.value + ' to ' + test.expected, function () {
|
|
|
|
assert.equal(coder.decodeParam(test.type, test.value), test.expected);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|