Skip to content

Commit

Permalink
Update test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
you21979 committed Jan 24, 2017
1 parent f43c92d commit 141d8a9
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions test/test.js
Expand Up @@ -6,24 +6,21 @@ describe('test', function () {
util.BASE_BYTE_PER_SATOSHI = 1;

describe('p2pkh test', function () {
var getTransactionFees = function(input_num, output_num){
return util.tx_calc_fee( util.tx_calc_byte(util.p2pkh_calc_input_byte(), input_num, output_num), util.get_base_byte_per_satoshi() )
}
it('p2pkh', function () {
assert.equal(getTransactionFees(1, 1), 192)
assert.equal(getTransactionFees(1, 2), 226)
assert.equal(getTransactionFees(2, 2), 374)
assert.equal(util.p2pkh_tx_calc_fee(1, 1), 192)
assert.equal(util.p2pkh_tx_calc_fee(1, 2), 226)
assert.equal(util.p2pkh_tx_calc_fee(2, 2), 374)
})
})
describe('p2sh test', function () {
var getMultisigTransactionFees = function(input_num, m, n){
return util.tx_calc_fee( util.tx_calc_byte(util.p2sh_calc_input_byte(m,n), input_num, 1), util.get_base_byte_per_satoshi() )
}
var p2sh_tx_calc_fee_1of1 = util.p2sh_tx_calc_fee_create(1, 1);
var p2sh_tx_calc_fee_1of2 = util.p2sh_tx_calc_fee_create(1, 2);
var p2sh_tx_calc_fee_2of3 = util.p2sh_tx_calc_fee_create(2, 3);
it('p2sh 1 of 1', function () {
assert.equal(getMultisigTransactionFees(1, 1, 1), 198)
assert.equal(p2sh_tx_calc_fee_1of1(1, 1), 198)
})
it('p2sh 2 of 3', function () {
assert.equal(getMultisigTransactionFees(1, 2, 3), 339)
assert.equal(p2sh_tx_calc_fee_2of3(1, 1), 339)
})
})
})

0 comments on commit 141d8a9

Please sign in to comment.