You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
1.2 KiB
23 lines
1.2 KiB
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'},
|
|
{ type: 'bytes32', value: 'gavofyork', expected: '6761766f66796f726b0000000000000000000000000000000000000000000000'},
|
|
{ type: 'bytes', value: 'gavofyork', expected: '0000000000000000000000000000000000000000000000000000000000000009' +
|
|
'6761766f66796f726b0000000000000000000000000000000000000000000000'}
|
|
];
|
|
|
|
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);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|