File: Regressions.hs

package info (click to toggle)
haskell-double-conversion 2.0.2.0%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 116 kB
  • sloc: haskell: 222; cpp: 108; ansic: 23; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Regressions
    (
      tests
    ) where

import Data.Double.Conversion.Text (toShortest)
import Test.HUnit (Assertion, assertEqual)
import Data.Text (unpack)
import Numeric (showFFloat)
import qualified Test.Framework as F
import qualified Test.Framework.Providers.HUnit as F

toShortest_overflow :: Assertion
toShortest_overflow = do
  let val = -2.9658956854023756e-5
  assertEqual "rendering a long number doesn't crash"
              (showFFloat Nothing val "") (unpack (toShortest val))

tests :: F.Test
tests = F.testGroup "Regressions"
  [
    F.testCase "toShortest_overflow" toShortest_overflow
  ]