Comparing version 1.1.1 to 1.2.0
@@ -53,2 +53,14 @@ | ||
test('Math#sin()', function(){ | ||
Math.sin(12).should.be.approximately(-0.5365, 1e-3); | ||
}); | ||
test('Math#cos()', function(){ | ||
Math.cos(0).should.not.be.approximately(10, 1e-3); | ||
}); | ||
test('Math#log()', function(){ | ||
Math.log(10).should.be.approximately(10, 1e-3); | ||
}); | ||
console.log(); |
1.2.0 / 2012-09-21 | ||
================== | ||
* Added #approximately(value, delta, description) for doing assertions on results of operations with numbers. [titarenko] | ||
1.1.1 / 2012-09-19 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -110,7 +110,6 @@ /*! | ||
* @param {Object} expected | ||
* @param {String} type | ||
* @api private | ||
*/ | ||
assert: function(expr, msg, negatedMsg, expected, type){ | ||
assert: function(expr, msg, negatedMsg, expected, showDiff){ | ||
var msg = this.negate ? negatedMsg : msg | ||
@@ -122,3 +121,3 @@ , ok = this.negate ? !expr : expr | ||
throw new AssertionError({ | ||
var err = new AssertionError({ | ||
message: msg.call(this) | ||
@@ -129,4 +128,7 @@ , actual: obj | ||
, negated: this.negate | ||
, type: type | ||
}); | ||
err.showDiff = showDiff; | ||
throw err; | ||
}, | ||
@@ -291,3 +293,3 @@ | ||
, val | ||
, 'equal'); | ||
, true); | ||
return this; | ||
@@ -332,2 +334,15 @@ }, | ||
/** | ||
* Assert within value +- delta (inclusive). | ||
* | ||
* @param {Number} value | ||
* @param {Number} delta | ||
* @param {String} description | ||
* @api public | ||
*/ | ||
approximately: function(value, delta, description) { | ||
return this.within(value - delta, value + delta, description); | ||
}, | ||
/** | ||
* Assert typeof. | ||
@@ -334,0 +349,0 @@ * |
{ "name": "should" | ||
, "description": "test framework agnostic BDD-style assertions" | ||
, "version": "1.1.1" | ||
, "version": "1.2.0" | ||
, "author": "TJ Holowaychuk <tj@vision-media.ca>" | ||
@@ -5,0 +5,0 @@ , "repository": { "type": "git", "url": "git://github.com/visionmedia/should.js.git" } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55585
1314