Reputation: 81
I am trying to do TDD in haskell using HSpec. So while writing special case scenario for division operator for example:
3 / 0 => Infinity
0 / 0 => Nan
How to test the above cases using Hspec ?
Upvotes: 1
Views: 85
Reputation: 52049
Use the functions isInfinite and isNaN:
Prelude> isInfinite (3 / 0.0)
True
Prelude> isNaN (0.0/0.0)
True
Upvotes: 7