@ -11,10 +11,7 @@ describe('ECSignature', function () {
describe ( 'toCompact' , function ( ) {
describe ( 'toCompact' , function ( ) {
fixtures . valid . forEach ( function ( f ) {
fixtures . valid . forEach ( function ( f ) {
it ( 'exports ' + f . compact . hex + ' correctly' , function ( ) {
it ( 'exports ' + f . compact . hex + ' correctly' , function ( ) {
var signature = new ECSignature (
var signature = new ECSignature ( new BigInteger ( f . signature . r ) , new BigInteger ( f . signature . s ) )
new BigInteger ( f . signature . r ) ,
new BigInteger ( f . signature . s )
)
var buffer = signature . toCompact ( f . compact . i , f . compact . compressed )
var buffer = signature . toCompact ( f . compact . i , f . compact . compressed )
assert . equal ( buffer . toString ( 'hex' ) , f . compact . hex )
assert . equal ( buffer . toString ( 'hex' ) , f . compact . hex )
@ -49,10 +46,7 @@ describe('ECSignature', function () {
describe ( 'toDER' , function ( ) {
describe ( 'toDER' , function ( ) {
fixtures . valid . forEach ( function ( f ) {
fixtures . valid . forEach ( function ( f ) {
it ( 'exports ' + f . DER + ' correctly' , function ( ) {
it ( 'exports ' + f . DER + ' correctly' , function ( ) {
var signature = new ECSignature (
var signature = new ECSignature ( new BigInteger ( f . signature . r ) , new BigInteger ( f . signature . s ) )
new BigInteger ( f . signature . r ) ,
new BigInteger ( f . signature . s )
)
var DER = signature . toDER ( )
var DER = signature . toDER ( )
assert . equal ( DER . toString ( 'hex' ) , f . DER )
assert . equal ( DER . toString ( 'hex' ) , f . DER )
@ -85,10 +79,7 @@ describe('ECSignature', function () {
describe ( 'toScriptSignature' , function ( ) {
describe ( 'toScriptSignature' , function ( ) {
fixtures . valid . forEach ( function ( f ) {
fixtures . valid . forEach ( function ( f ) {
it ( 'exports ' + f . scriptSignature . hex + ' correctly' , function ( ) {
it ( 'exports ' + f . scriptSignature . hex + ' correctly' , function ( ) {
var signature = new ECSignature (
var signature = new ECSignature ( new BigInteger ( f . signature . r ) , new BigInteger ( f . signature . s ) )
new BigInteger ( f . signature . r ) ,
new BigInteger ( f . signature . s )
)
var scriptSignature = signature . toScriptSignature ( f . scriptSignature . hashType )
var scriptSignature = signature . toScriptSignature ( f . scriptSignature . hashType )
assert . equal ( scriptSignature . toString ( 'hex' ) , f . scriptSignature . hex )
assert . equal ( scriptSignature . toString ( 'hex' ) , f . scriptSignature . hex )
@ -97,10 +88,7 @@ describe('ECSignature', function () {
fixtures . invalid . scriptSignature . forEach ( function ( f ) {
fixtures . invalid . scriptSignature . forEach ( function ( f ) {
it ( 'throws ' + f . exception , function ( ) {
it ( 'throws ' + f . exception , function ( ) {
var signature = new ECSignature (
var signature = new ECSignature ( new BigInteger ( f . signature . r ) , new BigInteger ( f . signature . s ) )
new BigInteger ( f . signature . r ) ,
new BigInteger ( f . signature . s )
)
assert . throws ( function ( ) {
assert . throws ( function ( ) {
signature . toScriptSignature ( f . hashType )
signature . toScriptSignature ( f . hashType )