We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
The text was updated successfully, but these errors were encountered:
Regarding the last part, wouldn't you need a Math.abs() for that?
Sorry, something went wrong.
@dodekeract Yes, of course. Thanks for pointing that!
Successfully merging a pull request may close this issue.
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.
The text was updated successfully, but these errors were encountered: