https://github.com/sdesalas/assert-fuzzy
Fuzzy logic assertions for nodejs `assert`.
https://github.com/sdesalas/assert-fuzzy
fuzzy-logic-assertions
Last synced: about 2 months ago
JSON representation
Fuzzy logic assertions for nodejs `assert`.
- Host: GitHub
- URL: https://github.com/sdesalas/assert-fuzzy
- Owner: sdesalas
- License: mit
- Created: 2016-12-21T12:18:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-21T12:32:13.000Z (over 8 years ago)
- Last Synced: 2025-02-22T18:05:51.494Z (3 months ago)
- Topics: fuzzy-logic-assertions
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# assert-fuzzy
Fuzzy logic assertions for nodejs `assert`.```
var assert = require('assert-fuzzy');assert.around(59.4, 60); // true
assert.around(72, 60); // false
```Use it for writing tests when your assertions require approximate figures.
```
var assert = require('assert-fuzzy');describe('class Thermometer', function() {
it('#getTemperature()', function() {
assert.around(Thermometer.getTemperature(), 20); // its around 20 degrees in the room
});
});describe('class Barometer', function() {
it('#getPressure()', function() {
assert.between(Barometer.getATM(), 0.9, 1.1); // its around 1 atmospheric unit of pressure in the room
});
});```