Skip to content

Commit

Permalink
added test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
youfoundron committed Aug 13, 2018
1 parent 42ad6c2 commit 1f4b723
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/methods/sum.js
@@ -0,0 +1,15 @@
if (typeof Test === 'undefined') require('../tester');

Test('sum', function () {

function t(expected, value){
Test.isTrue(expected.eq(value));
}

const expectedSum = new BigNumber(600)
t(expectedSum, BigNumber.sum(100, 200, 300))
t(expectedSum, BigNumber.sum('100', '200', '300'))
t(expectedSum, BigNumber.sum(new BigNumber(100), new BigNumber(200), new BigNumber(300)))
t(expectedSum, BigNumber.sum(100, '200', new BigNumber(300)))
t(expectedSum, BigNumber.sum(99.9, 200.05, 300.05))
})
1 change: 1 addition & 0 deletions test/test.js
Expand Up @@ -27,6 +27,7 @@ console.log('\n Testing bignumber.js\n');
'random',
'shiftedBy',
'squareRoot',
'sum',
'toExponential',
'toFixed',
'toFormat',
Expand Down

0 comments on commit 1f4b723

Please sign in to comment.