aboutsummaryrefslogtreecommitdiffstats
path: root/coder.encodeParam.js
blob: 52b0a04d5065444c82b29365fd2e669f6c78191f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var chai = require('chai');
var assert = chai.assert;
var coder = require('../lib/solidity/coder');

var tests = [
    { type: 'int', value: 1,    expected: '0000000000000000000000000000000000000000000000000000000000000001'},
    { type: 'int', value: 16,   expected: '0000000000000000000000000000000000000000000000000000000000000010'},
    { type: 'int', value: -1,   expected: 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'}
];

describe('lib/solidity/coder', function () {
    describe('encodeParam', function () {
        tests.forEach(function (test) {
            it('should turn ' + test.value + ' to ' + test.expected, function () {
                assert.equal(coder.encodeParam(test.type, test.value), test.expected);
            });
        });
    });
});