Move testsuite/tests/lib/Numeric to base/tests
authorIan Lynagh <igloo@earth.li>
Sat, 19 Nov 2011 22:37:56 +0000 (22:37 +0000)
committerIan Lynagh <igloo@earth.li>
Sat, 19 Nov 2011 22:37:56 +0000 (22:37 +0000)
38 files changed:
tests/Numeric/Makefile [new file with mode: 0644]
tests/Numeric/all.T [new file with mode: 0644]
tests/Numeric/num001.hs [new file with mode: 0644]
tests/Numeric/num001.stdout [new file with mode: 0644]
tests/Numeric/num002.hs [new file with mode: 0644]
tests/Numeric/num002.stdout [new file with mode: 0644]
tests/Numeric/num002.stdout-alpha-dec-osf3 [new file with mode: 0644]
tests/Numeric/num002.stdout-mips-sgi-irix [new file with mode: 0644]
tests/Numeric/num002.stdout-ws-64 [new file with mode: 0644]
tests/Numeric/num002.stdout-x86_64-unknown-openbsd [new file with mode: 0644]
tests/Numeric/num003.hs [new file with mode: 0644]
tests/Numeric/num003.stdout [new file with mode: 0644]
tests/Numeric/num003.stdout-alpha-dec-osf3 [new file with mode: 0644]
tests/Numeric/num003.stdout-mips-sgi-irix [new file with mode: 0644]
tests/Numeric/num003.stdout-ws-64 [new file with mode: 0644]
tests/Numeric/num003.stdout-x86_64-unknown-openbsd [new file with mode: 0644]
tests/Numeric/num004.hs [new file with mode: 0644]
tests/Numeric/num004.stdout [new file with mode: 0644]
tests/Numeric/num004.stdout-alpha-dec-osf3 [new file with mode: 0644]
tests/Numeric/num004.stdout-mips-sgi-irix [new file with mode: 0644]
tests/Numeric/num004.stdout-ws-64 [new file with mode: 0644]
tests/Numeric/num004.stdout-x86_64-unknown-openbsd [new file with mode: 0644]
tests/Numeric/num005.hs [new file with mode: 0644]
tests/Numeric/num005.stdout [new file with mode: 0644]
tests/Numeric/num005.stdout-alpha-dec-osf3 [new file with mode: 0644]
tests/Numeric/num005.stdout-mips-sgi-irix [new file with mode: 0644]
tests/Numeric/num005.stdout-ws-64 [new file with mode: 0644]
tests/Numeric/num005.stdout-x86_64-unknown-openbsd [new file with mode: 0644]
tests/Numeric/num006.hs [new file with mode: 0644]
tests/Numeric/num006.stdout [new file with mode: 0644]
tests/Numeric/num007.hs [new file with mode: 0644]
tests/Numeric/num007.stdout [new file with mode: 0644]
tests/Numeric/num008.hs [new file with mode: 0644]
tests/Numeric/num008.stdout [new file with mode: 0644]
tests/Numeric/num009.hs [new file with mode: 0644]
tests/Numeric/num009.stdout [new file with mode: 0644]
tests/Numeric/num010.hs [new file with mode: 0644]
tests/Numeric/num010.stdout [new file with mode: 0644]

diff --git a/tests/Numeric/Makefile b/tests/Numeric/Makefile
new file mode 100644 (file)
index 0000000..4ca7751
--- /dev/null
@@ -0,0 +1,7 @@
+# This Makefile runs the tests using GHC's testsuite framework.  It
+# assumes the package is part of a GHC build tree with the testsuite
+# installed in ../../../testsuite.
+
+TOP=../../../../testsuite
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/tests/Numeric/all.T b/tests/Numeric/all.T
new file mode 100644 (file)
index 0000000..d6237fb
--- /dev/null
@@ -0,0 +1,10 @@
+test('num001', normal, compile_and_run, [''])
+test('num002', normal, compile_and_run, [''])
+test('num003', normal, compile_and_run, [''])
+test('num004', normal, compile_and_run, [''])
+test('num005', normal, compile_and_run, [''])
+test('num006', normal, compile_and_run, [''])
+test('num007', normal, compile_and_run, [''])
+test('num008', normal, compile_and_run, [''])
+test('num009', compose(skip_if_fast, if_os('darwin', expect_broken(2370))), compile_and_run, [''])
+test('num010', normal, compile_and_run, [''])
diff --git a/tests/Numeric/num001.hs b/tests/Numeric/num001.hs
new file mode 100644 (file)
index 0000000..8a8c97a
--- /dev/null
@@ -0,0 +1,6 @@
+module Main(main) where
+
+import Numeric
+import Data.Ratio
+
+main = print ((fromRat (132874 % 23849))::Double)
diff --git a/tests/Numeric/num001.stdout b/tests/Numeric/num001.stdout
new file mode 100644 (file)
index 0000000..6d2f0c7
--- /dev/null
@@ -0,0 +1 @@
+5.571470501907837
diff --git a/tests/Numeric/num002.hs b/tests/Numeric/num002.hs
new file mode 100644 (file)
index 0000000..31ea76c
--- /dev/null
@@ -0,0 +1,20 @@
+-- Testing showInt, lightly.
+
+module Main(main) where
+
+import Numeric
+
+showSignedInt :: Integral a => a -> String
+showSignedInt x = showSigned (showInt) 0 x ""
+
+main = 
+  do
+   putStrLn (showInt (343023920121::Integer) [])
+   putStrLn (showInt (3430239::Int) [])
+   putStrLn (showInt (1212 :: Int) [])
+   putStrLn (showSignedInt (591125662431 `div` (517::Int)))
+   -- showInt just works over naturals, wrap it up inside
+   -- a use of Numeric.showSigned to show negative nums.
+   putStrLn (showSignedInt (-111::Int))
+   putStrLn (showInt (232189458241::Integer) [])
+
diff --git a/tests/Numeric/num002.stdout b/tests/Numeric/num002.stdout
new file mode 100644 (file)
index 0000000..ce14dec
--- /dev/null
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+-3055754
+-111
+232189458241
diff --git a/tests/Numeric/num002.stdout-alpha-dec-osf3 b/tests/Numeric/num002.stdout-alpha-dec-osf3
new file mode 100644 (file)
index 0000000..b81876f
--- /dev/null
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/tests/Numeric/num002.stdout-mips-sgi-irix b/tests/Numeric/num002.stdout-mips-sgi-irix
new file mode 100644 (file)
index 0000000..b81876f
--- /dev/null
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/tests/Numeric/num002.stdout-ws-64 b/tests/Numeric/num002.stdout-ws-64
new file mode 100644 (file)
index 0000000..b81876f
--- /dev/null
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/tests/Numeric/num002.stdout-x86_64-unknown-openbsd b/tests/Numeric/num002.stdout-x86_64-unknown-openbsd
new file mode 100644 (file)
index 0000000..b81876f
--- /dev/null
@@ -0,0 +1,6 @@
+343023920121
+3430239
+1212
+1143376523
+-111
+232189458241
diff --git a/tests/Numeric/num003.hs b/tests/Numeric/num003.hs
new file mode 100644 (file)
index 0000000..368be25
--- /dev/null
@@ -0,0 +1,20 @@
+-- Testing readInt, lightly.
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+main = 
+  let 
+   rd :: ReadS Integer 
+   rd = readSigned (readInt 10 (isDigit) (digitToInt))
+  in
+  do
+   print (rd (show (343023920121::Integer)))
+   print (rd (show (3430239::Int)))
+   print (rd (show (1212 :: Int)))
+   print (rd (show (591125662431 `div` (517::Int))))
+   print (rd (show (-111::Int)))
+   print (rd (show (232189458241::Integer)))
+
diff --git a/tests/Numeric/num003.stdout b/tests/Numeric/num003.stdout
new file mode 100644 (file)
index 0000000..1266b60
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(-3055754,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num003.stdout-alpha-dec-osf3 b/tests/Numeric/num003.stdout-alpha-dec-osf3
new file mode 100644 (file)
index 0000000..ae95d2a
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num003.stdout-mips-sgi-irix b/tests/Numeric/num003.stdout-mips-sgi-irix
new file mode 100644 (file)
index 0000000..ae95d2a
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num003.stdout-ws-64 b/tests/Numeric/num003.stdout-ws-64
new file mode 100644 (file)
index 0000000..ae95d2a
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num003.stdout-x86_64-unknown-openbsd b/tests/Numeric/num003.stdout-x86_64-unknown-openbsd
new file mode 100644 (file)
index 0000000..ae95d2a
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(1212,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num004.hs b/tests/Numeric/num004.hs
new file mode 100644 (file)
index 0000000..0eb2bee
--- /dev/null
@@ -0,0 +1,20 @@
+-- Exercising Numeric.readSigned a bit
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+main = 
+  let 
+   rd :: ReadS Integer 
+   rd = readSigned (readInt 10 (isDigit) (digitToInt))
+  in
+  do
+   print (rd (show (343023920121::Integer)))
+   print (rd (show (3430239::Int)))
+   print (rd (show (-0 :: Int)))
+   print (rd (show (591125662431 `div` (517::Int))))
+   print (rd (show (-111::Int)))
+   print (rd (show (232189458241::Integer)))
+
diff --git a/tests/Numeric/num004.stdout b/tests/Numeric/num004.stdout
new file mode 100644 (file)
index 0000000..12610a1
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(-3055754,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num004.stdout-alpha-dec-osf3 b/tests/Numeric/num004.stdout-alpha-dec-osf3
new file mode 100644 (file)
index 0000000..150f98e
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num004.stdout-mips-sgi-irix b/tests/Numeric/num004.stdout-mips-sgi-irix
new file mode 100644 (file)
index 0000000..150f98e
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num004.stdout-ws-64 b/tests/Numeric/num004.stdout-ws-64
new file mode 100644 (file)
index 0000000..150f98e
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num004.stdout-x86_64-unknown-openbsd b/tests/Numeric/num004.stdout-x86_64-unknown-openbsd
new file mode 100644 (file)
index 0000000..150f98e
--- /dev/null
@@ -0,0 +1,6 @@
+[(343023920121,"")]
+[(3430239,"")]
+[(0,"")]
+[(1143376523,"")]
+[(-111,"")]
+[(232189458241,"")]
diff --git a/tests/Numeric/num005.hs b/tests/Numeric/num005.hs
new file mode 100644 (file)
index 0000000..ef647a6
--- /dev/null
@@ -0,0 +1,23 @@
+-- Exercising Numeric.readSigned a bit
+--
+module Main(main) where
+
+import Numeric
+
+main = 
+  let 
+   ls = ["3489348394032498320438240938403","0","-1","1","34323","2L","012","0x23","3243ab"]
+   present str f ls =
+    sequence (map (\ v -> putStr ('\n':str ++ 
+                                  ' ': v   ++ 
+                                 " = "    ++ 
+                                 (show (f v)))) ls)
+  in
+  do
+   present "(readDec::ReadS Integer)" (readDec::ReadS Integer) ls
+   present "(readDec::ReadS Int)"     (readDec::ReadS Int) ls
+   present "(readOct::ReadS Integer)" (readOct::ReadS Integer) ls
+   present "(readOct::ReadS Int)"     (readOct::ReadS Int) ls
+   present "(readHex::ReadS Integer)" (readHex::ReadS Integer) ls
+   present "(readHex::ReadS Int)"     (readHex::ReadS Int) ls
+   putStrLn ""
diff --git a/tests/Numeric/num005.stdout b/tests/Numeric/num005.stdout
new file mode 100644 (file)
index 0000000..f6ba218
--- /dev/null
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(-1268053597,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(1083409411,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/tests/Numeric/num005.stdout-alpha-dec-osf3 b/tests/Numeric/num005.stdout-alpha-dec-osf3
new file mode 100644 (file)
index 0000000..35678af
--- /dev/null
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/tests/Numeric/num005.stdout-mips-sgi-irix b/tests/Numeric/num005.stdout-mips-sgi-irix
new file mode 100644 (file)
index 0000000..35678af
--- /dev/null
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/tests/Numeric/num005.stdout-ws-64 b/tests/Numeric/num005.stdout-ws-64
new file mode 100644 (file)
index 0000000..35678af
--- /dev/null
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/tests/Numeric/num005.stdout-x86_64-unknown-openbsd b/tests/Numeric/num005.stdout-x86_64-unknown-openbsd
new file mode 100644 (file)
index 0000000..35678af
--- /dev/null
@@ -0,0 +1,55 @@
+
+(readDec::ReadS Integer) 3489348394032498320438240938403 = [(3489348394032498320438240938403,"")]
+(readDec::ReadS Integer) 0 = [(0,"")]
+(readDec::ReadS Integer) -1 = []
+(readDec::ReadS Integer) 1 = [(1,"")]
+(readDec::ReadS Integer) 34323 = [(34323,"")]
+(readDec::ReadS Integer) 2L = [(2,"L")]
+(readDec::ReadS Integer) 012 = [(12,"")]
+(readDec::ReadS Integer) 0x23 = [(0,"x23")]
+(readDec::ReadS Integer) 3243ab = [(3243,"ab")]
+(readDec::ReadS Int) 3489348394032498320438240938403 = [(8154046292665502115,"")]
+(readDec::ReadS Int) 0 = [(0,"")]
+(readDec::ReadS Int) -1 = []
+(readDec::ReadS Int) 1 = [(1,"")]
+(readDec::ReadS Int) 34323 = [(34323,"")]
+(readDec::ReadS Int) 2L = [(2,"L")]
+(readDec::ReadS Int) 012 = [(12,"")]
+(readDec::ReadS Int) 0x23 = [(0,"x23")]
+(readDec::ReadS Int) 3243ab = [(3243,"ab")]
+(readOct::ReadS Integer) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Integer) 0 = [(0,"")]
+(readOct::ReadS Integer) -1 = []
+(readOct::ReadS Integer) 1 = [(1,"")]
+(readOct::ReadS Integer) 34323 = [(14547,"")]
+(readOct::ReadS Integer) 2L = [(2,"L")]
+(readOct::ReadS Integer) 012 = [(10,"")]
+(readOct::ReadS Integer) 0x23 = [(0,"x23")]
+(readOct::ReadS Integer) 3243ab = [(1699,"ab")]
+(readOct::ReadS Int) 3489348394032498320438240938403 = [(28,"89348394032498320438240938403")]
+(readOct::ReadS Int) 0 = [(0,"")]
+(readOct::ReadS Int) -1 = []
+(readOct::ReadS Int) 1 = [(1,"")]
+(readOct::ReadS Int) 34323 = [(14547,"")]
+(readOct::ReadS Int) 2L = [(2,"L")]
+(readOct::ReadS Int) 012 = [(10,"")]
+(readOct::ReadS Int) 0x23 = [(0,"x23")]
+(readOct::ReadS Int) 3243ab = [(1699,"ab")]
+(readHex::ReadS Integer) 3489348394032498320438240938403 = [(4364516597526947317207336190131536899,"")]
+(readHex::ReadS Integer) 0 = [(0,"")]
+(readHex::ReadS Integer) -1 = []
+(readHex::ReadS Integer) 1 = [(1,"")]
+(readHex::ReadS Integer) 34323 = [(213795,"")]
+(readHex::ReadS Integer) 2L = [(2,"L")]
+(readHex::ReadS Integer) 012 = [(18,"")]
+(readHex::ReadS Integer) 0x23 = [(0,"x23")]
+(readHex::ReadS Integer) 3243ab = [(3294123,"")]
+(readHex::ReadS Int) 3489348394032498320438240938403 = [(-8998117828778032125,"")]
+(readHex::ReadS Int) 0 = [(0,"")]
+(readHex::ReadS Int) -1 = []
+(readHex::ReadS Int) 1 = [(1,"")]
+(readHex::ReadS Int) 34323 = [(213795,"")]
+(readHex::ReadS Int) 2L = [(2,"L")]
+(readHex::ReadS Int) 012 = [(18,"")]
+(readHex::ReadS Int) 0x23 = [(0,"x23")]
+(readHex::ReadS Int) 3243ab = [(3294123,"")]
diff --git a/tests/Numeric/num006.hs b/tests/Numeric/num006.hs
new file mode 100644 (file)
index 0000000..f421ed7
--- /dev/null
@@ -0,0 +1,28 @@
+-- Exercising the showing of positive numbers at various bases.
+--
+module Main(main) where
+
+import Numeric
+import Data.Char
+
+--showDec :: Integral a => a -> ShowS
+showDec = showInt
+
+{-
+--showBinary :: Integral a => a -> ShowS
+showBinary n r = 
+ showString "0b" $
+ showIntAtBase 2 (toChr) n r
+ where toChr d = chr (ord '0' + fromIntegral d)
+-}
+
+main = 
+ do
+  print (map (\ x -> showOct x []) [1..32])
+  print (map (\ x -> showDec x []) [1..32])
+  print (map (\ x -> showHex x []) [1..32])
+--  print (map (\ x -> showBinary x []) [1..32])
+  putStrLn (showOct (241324784::Int) [])
+  putStrLn (showDec (241324784::Int) [])
+  putStrLn (showHex (241324784::Int) [])
+---  putStrLn (showBinary (241324784::Int) [])
diff --git a/tests/Numeric/num006.stdout b/tests/Numeric/num006.stdout
new file mode 100644 (file)
index 0000000..e0c4540
--- /dev/null
@@ -0,0 +1,6 @@
+["1","2","3","4","5","6","7","10","11","12","13","14","15","16","17","20","21","22","23","24","25","26","27","30","31","32","33","34","35","36","37","40"]
+["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32"]
+["1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20"]
+1630451360
+241324784
+e6252f0
diff --git a/tests/Numeric/num007.hs b/tests/Numeric/num007.hs
new file mode 100644 (file)
index 0000000..1c40ecf
--- /dev/null
@@ -0,0 +1,17 @@
+-- Exercising the reading of positive numbers at various bases.
+--
+module Main(main) where
+
+import Numeric
+
+main = 
+ do
+  putStrLn (show (readOct "00000111"))
+  putStrLn (show (readDec "00000111"))
+  putStrLn (show (readHex "00000111"))
+  putStrLn (show (readOct "-24"))
+  putStrLn (show (readDec "-24"))
+  putStrLn (show (readHex "-24"))
+  putStrLn (show ((readOct ::ReadS Integer) "3248784372843778438743"))
+  putStrLn (show ((readDec ::ReadS Integer) "3248784372843778438743"))
+  putStrLn (show ((readHex ::ReadS Integer) "3248784372843778438743"))
diff --git a/tests/Numeric/num007.stdout b/tests/Numeric/num007.stdout
new file mode 100644 (file)
index 0000000..ef60021
--- /dev/null
@@ -0,0 +1,9 @@
+[(73,"")]
+[(111,"")]
+[(273,"")]
+[]
+[]
+[]
+[(212,"8784372843778438743")]
+[(3248784372843778438743,"")]
+[(60788519836879239998834499,"")]
diff --git a/tests/Numeric/num008.hs b/tests/Numeric/num008.hs
new file mode 100644 (file)
index 0000000..3615824
--- /dev/null
@@ -0,0 +1,57 @@
+-- showing/reading floats
+--
+module Main(main) where
+
+import Numeric
+
+main = do
+  let dbls   =  map (shEFloat (Just 7)) doubles
+            ++ map (shEFloat (Just 0)) doubles
+            ++ map (shEFloat Nothing)  doubles
+            ++ map (shFFloat (Just 7)) doubles
+            ++ map (shFFloat (Just 0)) doubles
+            ++ map (shFFloat Nothing)  doubles
+            ++ map (shGFloat (Just 7)) doubles
+            ++ map (shGFloat (Just 0)) doubles
+            ++ map (shGFloat Nothing)  doubles
+
+      flts   =  map (shEFloat (Just 7)) floats
+            ++ map (shEFloat (Just 0)) floats
+            ++ map (shEFloat Nothing)  floats
+            ++ map (shFFloat (Just 7)) floats
+            ++ map (shFFloat (Just 0)) floats
+            ++ map (shFFloat Nothing)  floats
+            ++ map (shGFloat (Just 7)) floats
+            ++ map (shGFloat (Just 0)) floats
+            ++ map (shGFloat Nothing)  floats
+
+  putStrLn (unlines dbls)
+  putStrLn (unlines flts)
+  print (map read dbls :: [Double])
+  print (map read flts :: [Double])
+
+shEFloat p f = showEFloat p f ""
+shFFloat p f = showFFloat p f ""
+shGFloat p f = showGFloat p f ""
+
+doubles :: [ Double ]
+doubles = [ 0.0
+         , 420
+         ,  42
+         ,   4.2
+         ,   0.42
+         ,   0.042
+         , 1.82173691287639817263897126389712638972163
+         , 1.82173691287639817263897126389712638972163e-300
+         ]
+
+floats :: [ Float ]
+floats = [ 0.0
+         , 420
+         ,  42
+         ,   4.2
+         ,   0.42
+         ,   0.042
+         , 1.82173691287639817263897126389712638972163
+         , 1.82173691287639817263897126389712638972163e-300
+         ]
diff --git a/tests/Numeric/num008.stdout b/tests/Numeric/num008.stdout
new file mode 100644 (file)
index 0000000..5086442
--- /dev/null
@@ -0,0 +1,148 @@
+0.0000000e0
+4.2000000e2
+4.2000000e1
+4.2000000e0
+4.2000000e-1
+4.2000000e-2
+1.8217369e0
+1.8217369e-300
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8e0
+1.8e-300
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8217369128763983e0
+1.821736912876398e-300
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+0.0420000
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+0
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+0.042
+1.8217369128763983
+0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001821736912876398
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+4.2000000e-2
+1.8217369
+1.8217369e-300
+0
+420
+42
+4
+0
+4.2e-2
+2
+1.8e-300
+0.0
+420.0
+42.0
+4.2
+0.42
+4.2e-2
+1.8217369128763983
+1.821736912876398e-300
+
+0.0000000e0
+4.2000000e2
+4.2000000e1
+4.2000000e0
+4.2000000e-1
+4.2000000e-2
+1.8217369e0
+0.0000000e0
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8e0
+0.0e0
+0.0e0
+4.2e2
+4.2e1
+4.2e0
+4.2e-1
+4.2e-2
+1.8217369e0
+0.0e0
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+0.0420000
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+0
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+0.042
+1.8217369
+0.0
+0.0000000
+420.0000000
+42.0000000
+4.2000000
+0.4200000
+4.2000000e-2
+1.8217369
+0.0000000
+0
+420
+42
+4
+0
+4.2e-2
+2
+0
+0.0
+420.0
+42.0
+4.2
+0.42
+4.2e-2
+1.8217369
+0.0
+
+[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,1.8217369e-300,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,1.8e-300,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369128763983,1.821736912876398e-300]
+[0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,0.0,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0,0.0,420.0,42.0,4.0,0.0,4.2e-2,2.0,0.0,0.0,420.0,42.0,4.2,0.42,4.2e-2,1.8217369,0.0]
diff --git a/tests/Numeric/num009.hs b/tests/Numeric/num009.hs
new file mode 100644 (file)
index 0000000..58ab586
--- /dev/null
@@ -0,0 +1,39 @@
+-- trac #2059
+
+{-# LANGUAGE ForeignFunctionInterface #-}
+
+module Main(main) where
+
+import Control.Monad
+import Foreign.C
+
+main = do let d = 1e20 :: Double
+              f = 1e20 :: Float
+          test "sind" sind sin d
+          test "sinf" sinf sin f
+          test "cosd" cosd cos d
+          test "cosf" cosf cos f
+          test "tand" tand tan d
+          test "tanf" tanf tan f
+          putStrLn "Done"
+
+test :: (RealFloat a, Floating a, RealFloat b, Floating b, Show b)
+     => String -> (a -> a) -> (b -> b) -> b -> IO ()
+test s f g x = do let y = realToFrac (f (realToFrac x))
+                      z = g x
+                  unless (y == z) $ do
+                      putStrLn s
+                      print y
+                      print z
+                      print $ decodeFloat y
+                      print $ decodeFloat z
+
+foreign import ccall "math.h sin"  sind :: CDouble -> CDouble
+foreign import ccall "math.h sinf" sinf :: CFloat  -> CFloat
+
+foreign import ccall "math.h cos"  cosd :: CDouble -> CDouble
+foreign import ccall "math.h cosf" cosf :: CFloat  -> CFloat
+
+foreign import ccall "math.h tan"  tand :: CDouble -> CDouble
+foreign import ccall "math.h tanf" tanf :: CFloat  -> CFloat
+
diff --git a/tests/Numeric/num009.stdout b/tests/Numeric/num009.stdout
new file mode 100644 (file)
index 0000000..a965a70
--- /dev/null
@@ -0,0 +1 @@
+Done
diff --git a/tests/Numeric/num010.hs b/tests/Numeric/num010.hs
new file mode 100644 (file)
index 0000000..bf1d5a2
--- /dev/null
@@ -0,0 +1,29 @@
+
+module Main(main) where
+
+main = sequence_ [ f x y | x <- [0,
+                                 1000,
+                                 1000000000000,              -- > 2^32
+                                 1000000000000000000000000,  -- > 2^64
+                                 -1000,
+                                 -1000000000000,             -- < -2^32
+                                 -1000000000000000000000000] -- < -2^64
+                         , y <- [0, -10, 10] ]
+
+f :: Integer -> Int -> IO ()
+f x y = do putStrLn "------------------------"
+           print x
+           print y
+           let d :: Double
+               d = encodeFloat x y
+               (xd, yd) = decodeFloat d
+           let f :: Float
+               f = encodeFloat x y
+               (xf, yf) = decodeFloat f
+           print d
+           print xd
+           print yd
+           print f
+           print xf
+           print yf
+
diff --git a/tests/Numeric/num010.stdout b/tests/Numeric/num010.stdout
new file mode 100644 (file)
index 0000000..877d35c
--- /dev/null
@@ -0,0 +1,189 @@
+------------------------
+0
+0
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+0
+-10
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+0
+10
+0.0
+0
+0
+0.0
+0
+0
+------------------------
+1000
+0
+1000.0
+8796093022208000
+-43
+1000.0
+16384000
+-14
+------------------------
+1000
+-10
+0.9765625
+8796093022208000
+-53
+0.9765625
+16384000
+-24
+------------------------
+1000
+10
+1024000.0
+8796093022208000
+-33
+1024000.0
+16384000
+-4
+------------------------
+1000000000000
+0
+1.0e12
+8192000000000000
+-13
+1.0e12
+15258789
+16
+------------------------
+1000000000000
+-10
+9.765625e8
+8192000000000000
+-23
+9.765625e8
+15258789
+6
+------------------------
+1000000000000
+10
+1.024e15
+8192000000000000
+-3
+1.024e15
+15258789
+26
+------------------------
+1000000000000000000000000
+0
+1.0e24
+7450580596923828
+27
+1.0e24
+13877788
+56
+------------------------
+1000000000000000000000000
+-10
+9.765625e20
+7450580596923828
+17
+9.765625e20
+13877788
+46
+------------------------
+1000000000000000000000000
+10
+1.024e27
+7450580596923828
+37
+1.024e27
+13877788
+66
+------------------------
+-1000
+0
+-1000.0
+-8796093022208000
+-43
+-1000.0
+-16384000
+-14
+------------------------
+-1000
+-10
+-0.9765625
+-8796093022208000
+-53
+-0.9765625
+-16384000
+-24
+------------------------
+-1000
+10
+-1024000.0
+-8796093022208000
+-33
+-1024000.0
+-16384000
+-4
+------------------------
+-1000000000000
+0
+-1.0e12
+-8192000000000000
+-13
+-1.0e12
+-15258789
+16
+------------------------
+-1000000000000
+-10
+-9.765625e8
+-8192000000000000
+-23
+-9.765625e8
+-15258789
+6
+------------------------
+-1000000000000
+10
+-1.024e15
+-8192000000000000
+-3
+-1.024e15
+-15258789
+26
+------------------------
+-1000000000000000000000000
+0
+-1.0e24
+-7450580596923828
+27
+-1.0e24
+-13877788
+56
+------------------------
+-1000000000000000000000000
+-10
+-9.765625e20
+-7450580596923828
+17
+-9.765625e20
+-13877788
+46
+------------------------
+-1000000000000000000000000
+10
+-1.024e27
+-7450580596923828
+37
+-1.024e27
+-13877788
+66