summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-11-19 22:26:41 +0000
committerIan Lynagh <igloo@earth.li>2011-11-19 22:26:41 +0000
commit7593ffdacb728b2a9fdc8fa59950df5b037afdfd (patch)
tree019c39845655839b794dbe89db4cb8c327513bc2
parent90e8b87f407ba3ad276d6ca8531f6a6c1249fa7e (diff)
downloadhaskell-7593ffdacb728b2a9fdc8fa59950df5b037afdfd.tar.gz
Move testsuite/tests/lib/Show to base/tests
-rw-r--r--libraries/base/tests/all.T1
-rw-r--r--libraries/base/tests/showDouble.hs41
-rw-r--r--libraries/base/tests/showDouble.stdout22
3 files changed, 64 insertions, 0 deletions
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index eb63bb74db..fdc34f7b0e 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -17,4 +17,5 @@ test('unicode002',
compile_and_run,
[''])
test('data-fixed-show-read', normal, compile_and_run, [''])
+test('showDouble', normal, compile_and_run, [''])
diff --git a/libraries/base/tests/showDouble.hs b/libraries/base/tests/showDouble.hs
new file mode 100644
index 0000000000..399af28450
--- /dev/null
+++ b/libraries/base/tests/showDouble.hs
@@ -0,0 +1,41 @@
+
+module Main (main) where
+
+main :: IO ()
+main = do let xs = [p0, p01, p3, p31, n0, n01, n3, n31, pinf, ninf, nan]
+ mapM_ print xs
+ mapM_ (print . Just) xs
+
+p0 :: Double
+p0 = 0
+
+p01 :: Double
+p01 = 0.1
+
+p3 :: Double
+p3 = 3
+
+p31 :: Double
+p31 = 3.1
+
+n0 :: Double
+n0 = -0
+
+n01 :: Double
+n01 = -0.1
+
+n3 :: Double
+n3 = -3
+
+n31 :: Double
+n31 = -3.1
+
+pinf :: Double
+pinf = 1 / 0
+
+ninf :: Double
+ninf = - 1 / 0
+
+nan :: Double
+nan = 0 / 0
+
diff --git a/libraries/base/tests/showDouble.stdout b/libraries/base/tests/showDouble.stdout
new file mode 100644
index 0000000000..fb1b4de5e4
--- /dev/null
+++ b/libraries/base/tests/showDouble.stdout
@@ -0,0 +1,22 @@
+0.0
+0.1
+3.0
+3.1
+-0.0
+-0.1
+-3.0
+-3.1
+Infinity
+-Infinity
+NaN
+Just 0.0
+Just 0.1
+Just 3.0
+Just 3.1
+Just (-0.0)
+Just (-0.1)
+Just (-3.0)
+Just (-3.1)
+Just Infinity
+Just (-Infinity)
+Just NaN