Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 HSpec 在 haskell 中进行 TDD。因此,在为除法运算符编写特殊情况时,例如:
3 / 0 => Infinity
0 / 0 => Nan
如何使用 Hspec 测试上述情况?
使用函数isInfinite和isNaN:
Prelude> isInfinite (3 / 0.0) True Prelude> isNaN (0.0/0.0) True