Skip to content

Commit

Permalink
More negative zero tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Nov 6, 2015
1 parent 74f1cd9 commit 31842a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/format-type-x-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ tape("format(\"x\") rounds non-integers", function(test) {
test.end();
});

tape("format(\"x\") can format negative zero as zero", function(test) {
test.equal(format.format("x")(-0), "0");
test.equal(format.format("x")(-1e-12), "0");
test.end();
});

tape("format(\"x\") does not consider -0xeee to be positive", function(test) {
test.equal(format.format("x")(-0xeee), "-eee");
test.end();
Expand All @@ -65,6 +71,12 @@ tape("format(\"#X\") returns the expected hexadecimal (uppercase) string with pr
test.end();
});

tape("format(\"X\") can format negative zero as zero", function(test) {
test.equal(format.format("X")(-0), "0");
test.equal(format.format("X")(-1e-12), "0");
test.end();
});

tape("format(\"X\") does not consider -0xeee to be positive", function(test) {
test.equal(format.format("X")(-0xeee), "-EEE");
test.end();
Expand Down

0 comments on commit 31842a1

Please sign in to comment.