diff --git a/test/constructor-test.js b/test/constructor-test.js index 9f27203..8bbb727 100644 --- a/test/constructor-test.js +++ b/test/constructor-test.js @@ -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 () {