qunit-assert-compare
A QUnit plugin for asserting numerical comparisons like greater than, less than, etc.
QUnit numerical comparison assertion plugin
This plugin for QUnit adds a handful of custom assertion methods to test for various numerical comparison situations:
eq
: equal toneq
: not equal tolt
: less thanlte
: less than or equal togt
: greater thangte
: greater than or equal tocompare
: sorting-style comparisons
Usage
assert;assert;assert;assert;assert;assert;assert;
Where:
num1
: The lefthand operandnum2
: The righthand operandmessage
: Optional message, same as for other assertionsexpected
: [ONLY used forassert.compare
!] A sorting-style return value for the numerical comparison:-1
(less than)0
(equal to)1
(greater than)
Examples
module'Example module' ;
For more examples, refer to the unit tests.
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
License
Copyright (c) 2015-2016 James M. Greene Licensed under the MIT license.