@@ -7,8 +7,8 @@ describe('BigInteger', function() {
77 describe ( 'fromBuffer/fromHex' , function ( ) {
88 it ( 'should match the test vectors' , function ( ) {
99 fixtures . valid . forEach ( function ( f ) {
10- assert . deepEqual ( BigInteger . fromHex ( f . hex ) . toString ( ) , f . dec )
11- assert . deepEqual ( BigInteger . fromHex ( f . hexPadded ) . toString ( ) , f . dec )
10+ assert . equal ( BigInteger . fromHex ( f . hex ) . toString ( ) , f . dec )
11+ assert . equal ( BigInteger . fromHex ( f . hexPadded ) . toString ( ) , f . dec )
1212 } )
1313 } )
1414
@@ -24,21 +24,21 @@ describe('BigInteger', function() {
2424 describe ( 'toBuffer/toHex' , function ( ) {
2525 it ( 'should match the test vectors' , function ( ) {
2626 fixtures . valid . forEach ( function ( f ) {
27- var actualHex = new BigInteger ( f . dec ) . toHex ( )
27+ var bi = new BigInteger ( f . dec )
2828
29- assert . equal ( actualHex , f . hex )
29+ assert . equal ( bi . toHex ( ) , f . hex )
30+ assert . equal ( bi . toHex ( 32 ) , f . hexPadded )
3031 } )
3132 } )
32- } )
3333
34- describe ( 'toPaddedBuffer' , function ( ) {
35- it ( 'should match the test vectors' , function ( ) {
36- fixtures . valid . forEach ( function ( f ) {
37- var actualBuf = new BigInteger ( f . dec ) . toPaddedBuffer ( 32 )
34+ it ( 'throws on non-finite padding value' , function ( ) {
35+ var bi = new BigInteger ( '1' )
3836
39- assert . equal ( actualBuf . length , 32 )
40- assert . equal ( actualBuf . toString ( 'hex' ) , f . hexPadded )
41- } )
37+ assert . throws ( function ( ) { bi . toHex ( { } ) } )
38+ assert . throws ( function ( ) { bi . toHex ( [ ] ) } )
39+ assert . throws ( function ( ) { bi . toHex ( '' ) } )
40+ assert . throws ( function ( ) { bi . toHex ( 0 / 0 ) } )
41+ assert . throws ( function ( ) { bi . toHex ( 1 / 0 ) } )
4242 } )
4343 } )
4444} )
0 commit comments