diff --git a/tests/jasmine/core/toFixedSpec.js b/tests/jasmine/core/toFixedSpec.js new file mode 100644 index 0000000..b9e6869 --- /dev/null +++ b/tests/jasmine/core/toFixedSpec.js @@ -0,0 +1,16 @@ +describe('toFixed()', function(){ + + it('should work with all float rounding edge cases', function(){ + expect( accounting.toFixed(1.005, 2) ).toBe( '1.01' ); + expect( accounting.toFixed(1.005, 20) ).toBe( '1.00500000000000000000' ); + }); + + it('should round negative values away from zero', function(){ + expect( accounting.toFixed(-1.005, 2) ).toBe( '-1.01' ); + }); + + it('should accept negative exponents', function(){ + expect( accounting.toFixed(2.7755e-10, 2) ).toBe( '0.00' ); + }); + +}); diff --git a/tests/jasmine/runner.html b/tests/jasmine/runner.html index 54be51c..b973d8b 100644 --- a/tests/jasmine/runner.html +++ b/tests/jasmine/runner.html @@ -11,6 +11,7 @@ +