File: precisionFixed-test.js

package info (click to toggle)
d3-format 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 524 kB
  • sloc: makefile: 60
file content (12 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
var tape = require("tap").test,
    format = require("../");

tape("precisionFixed(number) returns the expected value", function(test) {
  test.equal(format.precisionFixed(8.9), 0);
  test.equal(format.precisionFixed(1.1), 0);
  test.equal(format.precisionFixed(0.89), 1);
  test.equal(format.precisionFixed(0.11), 1);
  test.equal(format.precisionFixed(0.089), 2);
  test.equal(format.precisionFixed(0.011), 2);
  test.end();
});