Skip to content

Commit

Permalink
[fix] Properly handle NaN in assert.inDelta extension. Fixes #120.…
Browse files Browse the repository at this point in the history
… Thanks @mbostock!
  • Loading branch information
indexzero committed Nov 4, 2014
1 parent 1b44458 commit 1c598f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/assert/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ assert.lesser = function (actual, expected, message) {
assert.inDelta = function (actual, expected, delta, message) {
var lower = expected - delta;
var upper = expected + delta;
if (actual < lower || actual > upper) {
if (actual != +actual || actual < lower || actual > upper) {
assert.fail(actual, expected, message || "expected {actual} to be in within *" + delta.toString() + "* of {expected}", null, assert.inDelta);
}
};
Expand Down

0 comments on commit 1c598f0

Please sign in to comment.