Add a test for reading Doubles
authorIan Lynagh <igloo@earth.li>
Thu, 1 Mar 2012 13:57:54 +0000 (13:57 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 1 Mar 2012 13:57:54 +0000 (13:57 +0000)
tests/all.T
tests/readDouble001.hs [new file with mode: 0644]
tests/readDouble001.stdout [new file with mode: 0644]

index 4b7d905..7addfd1 100644 (file)
@@ -18,6 +18,7 @@ test('unicode002',
      [''])
 test('data-fixed-show-read', normal, compile_and_run, [''])
 test('showDouble', normal, compile_and_run, [''])
+test('readDouble001', normal, compile_and_run, [''])
 test('hash001', normal, compile_and_run, [''])
 test('lex001', normal, compile_and_run, [''])
 test('take001', extra_run_opts('1'), compile_and_run, [''])
diff --git a/tests/readDouble001.hs b/tests/readDouble001.hs
new file mode 100644 (file)
index 0000000..f111ac5
--- /dev/null
@@ -0,0 +1,11 @@
+
+main :: IO ()
+main = do f "Infinity"
+          f "-Infinity"
+          f "  -  Infinity  "
+          f "NaN"
+          f "-NaN"
+          f "  -  NaN  "
+
+f :: String -> IO ()
+f str = print (reads str :: [(Double, String)])
diff --git a/tests/readDouble001.stdout b/tests/readDouble001.stdout
new file mode 100644 (file)
index 0000000..ddbbe1e
--- /dev/null
@@ -0,0 +1,6 @@
+[(Infinity,"")]
+[(-Infinity,"")]
+[(-Infinity,"  ")]
+[(NaN,"")]
+[(NaN,"")]
+[(NaN,"  ")]