Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lsrcz committed Jun 5, 2024
1 parent 97e3373 commit df735df
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/RunUnitTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ main =
, testGroup "bfIsSubnormal (float32 NearEven)"
(map (\bf -> bfSubnormalTestCase bf False)
[bfPosZero, bfFromInt 1, bfFromInt 0, bfNaN, bfNegInf, bfPosInf])
, testGroup "IEEE 754 compare"
[ testGroup "Comparisons with NaN should always return False"
[ testCase "NaN > 0" $ False @=? bfNaN > bfPosZero
, testCase "0 > NaN" $ False @=? bfPosZero > bfNaN
, testCase "NaN >= 0" $ False @=? bfNaN >= bfPosZero
, testCase "0 >= NaN" $ False @=? bfPosZero >= bfNaN
, testCase "NaN < 0" $ False @=? bfNaN < bfPosZero
, testCase "0 < NaN" $ False @=? bfPosZero < bfNaN
, testCase "NaN <= 0" $ False @=? bfNaN <= bfPosZero
, testCase "0 <= NaN" $ False @=? bfPosZero <= bfNaN
]
]
]

statusUnderflow :: Status -> Bool
Expand Down

0 comments on commit df735df

Please sign in to comment.