round-10.js 593 B

12345678910111213141516171819
  1. "use strict";
  2. var assert = require("chai").assert
  3. , round10 = require("../../math/round-10");
  4. describe("math/round-10", function () {
  5. it("Should round", function () {
  6. assert.equal(round10(55.55, -1), 55.6);
  7. assert.equal(round10(55.549, -1), 55.5);
  8. assert.equal(round10(55, 1), 60);
  9. assert.equal(round10(54.9, 1), 50);
  10. assert.equal(round10(-55.55, -1), -55.5);
  11. assert.equal(round10(-55.551, -1), -55.6);
  12. assert.equal(round10(-55, 1), -50);
  13. assert.equal(round10(-55.1, 1), -60);
  14. assert.equal(round10(1.005, -2), 1.01);
  15. assert.equal(round10(-1.005, -2), -1.0);
  16. });
  17. });