bufferutils: return opcode for use

This commit is contained in:
Daniel Cousens 2014-05-30 16:28:13 +10:00
parent 13f95d4ecf
commit 7e9b5d8584
2 changed files with 3 additions and 0 deletions

View file

@ -37,6 +37,7 @@ function readPushDataInt(buffer, offset) {
}
return {
opcode: opcode,
number: number,
size: size
}

View file

@ -23,7 +23,9 @@ describe('bufferutils', function() {
it('decodes ' + f.hexPD + ' correctly', function() {
var buffer = new Buffer(f.hexPD, 'hex')
var d = bufferutils.readPushDataInt(buffer, 0)
var fopcode = parseInt(f.hexPD.substr(0, 2), 16)
assert.equal(d.opcode, fopcode)
assert.equal(d.number, f.dec)
assert.equal(d.size, buffer.length)
})