phoenix
phoenix

Reputation: 81

How to division operator scenario when denominator is zero , or both numerator and denominator are zero?

I am trying to do TDD in haskell using HSpec. So while writing special case scenario for division operator for example:

How to test the above cases using Hspec ?

Upvotes: 1

Views: 85

Answers (1)

ErikR
ErikR

Reputation: 52049

Use the functions isInfinite and isNaN:

Prelude> isInfinite (3 / 0.0)
True
Prelude> isNaN (0.0/0.0)
True

Upvotes: 7

Related Questions