chai.js has cool API that allows for checking if two values (including floats) are close to each other.
For example, you can't realy check
expect(0.1+0.2).to.be(0.3)
because there is always rounding error in floating point calculation.
So instead in chai you write
let EPS = 1e-5;
expect(0.1+0.2).to.be.closeTo(0.3, EPS)
This function is oneliner, so this totaly fits "minimalistic" idea.
I know that I can use something like
expect(abs(f1-f2)).to.be.below(EPS)
but this is not very intuitive for reader that my intention is just check that f1 and f2 are just close to each other.
chai.js has cool API that allows for checking if two values (including floats) are close to each other.
For example, you can't realy check
because there is always rounding error in floating point calculation.
So instead in chai you write
This function is oneliner, so this totaly fits "minimalistic" idea.
I know that I can use something like
but this is not very intuitive for reader that my intention is just check that f1 and f2 are just close to each other.