tests: add toScript tests

This commit is contained in:
Daniel Cousens 2016-12-15 10:57:53 +11:00 committed by Daniel Cousens
parent 2bb021ab64
commit b2a2a2a136
2 changed files with 78 additions and 12 deletions

View file

@ -62,6 +62,20 @@ describe('script', function () {
})
})
describe('toStack', function () {
fixtures.valid.forEach(function (f) {
if (!f.scriptSig) return
it('returns ' + f.pushOnlySig + ' for ' + f.scriptSig, function () {
var script = bscript.fromASM(f.scriptSig)
var chunks = bscript.decompile(script)
var stack = bscript.toStack(chunks).map(x => x.toString('hex'))
assert.deepEqual(stack, f.scriptSigStack)
})
})
})
describe('compile (via fromASM)', function () {
fixtures.valid.forEach(function (f) {
if (f.scriptSig) {