|
|
@ -22,7 +22,7 @@ describe('Script', function() { |
|
|
|
buf[0] = Opcode('OP_0').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(1); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should parse this buffer containing another OP code', function() { |
|
|
@ -30,7 +30,7 @@ describe('Script', function() { |
|
|
|
buf[0] = Opcode('OP_CHECKMULTISIG').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(1); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should parse this buffer containing three bytes of data', function() { |
|
|
@ -75,9 +75,9 @@ describe('Script', function() { |
|
|
|
buf[buf.length - 1] = Opcode('OP_0').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(3); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
script.chunks[1].buf.toString('hex').should.equal('010203'); |
|
|
|
script.chunks[2].should.equal(buf[buf.length - 1]); |
|
|
|
script.chunks[2].opcodenum.should.equal(buf[buf.length - 1]); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
@ -89,7 +89,7 @@ describe('Script', function() { |
|
|
|
buf[0] = Opcode('OP_0').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(1); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
script.toBuffer().toString('hex').should.equal(buf.toString('hex')); |
|
|
|
}); |
|
|
|
|
|
|
@ -98,7 +98,7 @@ describe('Script', function() { |
|
|
|
buf[0] = Opcode('OP_CHECKMULTISIG').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(1); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
script.toBuffer().toString('hex').should.equal(buf.toString('hex')); |
|
|
|
}); |
|
|
|
|
|
|
@ -148,9 +148,9 @@ describe('Script', function() { |
|
|
|
buf[buf.length - 1] = Opcode('OP_0').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(3); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
script.chunks[1].buf.toString('hex').should.equal('010203'); |
|
|
|
script.chunks[2].should.equal(buf[buf.length - 1]); |
|
|
|
script.chunks[2].opcodenum.should.equal(buf[buf.length - 1]); |
|
|
|
script.toBuffer().toString('hex').should.equal(buf.toString('hex')); |
|
|
|
}); |
|
|
|
|
|
|
@ -182,9 +182,9 @@ describe('Script', function() { |
|
|
|
buf[buf.length - 1] = Opcode('OP_0').toNumber(); |
|
|
|
var script = Script.fromBuffer(buf); |
|
|
|
script.chunks.length.should.equal(3); |
|
|
|
script.chunks[0].should.equal(buf[0]); |
|
|
|
script.chunks[0].opcodenum.should.equal(buf[0]); |
|
|
|
script.chunks[1].buf.toString('hex').should.equal('010203'); |
|
|
|
script.chunks[2].should.equal(buf[buf.length - 1]); |
|
|
|
script.chunks[2].opcodenum.should.equal(buf[buf.length - 1]); |
|
|
|
script.toString().toString('hex').should.equal('OP_0 OP_PUSHDATA4 3 0x010203 OP_0'); |
|
|
|
}); |
|
|
|
|
|
|
|