Skip to content

Commit

Permalink
add more invalid hex tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Nov 30, 2017
1 parent 882c681 commit 3e4db81
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/constructor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ describe('BN.js/Constructor', function () {
res;
}, /Invalid character/);
});

it('should not accept non-hex characters', function () {
[
'0000000z',
'0000000gg',
'00000gg00',
'fffffggff',
'fffffggff',
'hexidecimal'
].forEach(function (str) {
assert.throws(function () {
var res = new BN(str, 16);
res;
}, /Invalid character in /);
});
})
});

describe('with Array input', function () {
Expand Down

0 comments on commit 3e4db81

Please sign in to comment.