[project @ 1997-12-19 12:22:57 by simonm]
authorsimonm <unknown>
Fri, 19 Dec 1997 12:23:51 +0000 (12:23 +0000)
committersimonm <unknown>
Fri, 19 Dec 1997 12:23:51 +0000 (12:23 +0000)
Move array tests from ghc/lib to ghc/tests and put them in our test
framework.

25 files changed:
ghc/lib/tests/Array/arr001/Main.hs [deleted file]
ghc/lib/tests/Array/arr001/Makefile [deleted file]
ghc/lib/tests/Array/arr002/Main.hs [deleted file]
ghc/lib/tests/Array/arr002/Makefile [deleted file]
ghc/lib/tests/Array/arr003/Main.hs [deleted file]
ghc/lib/tests/Array/arr003/Makefile [deleted file]
ghc/lib/tests/Array/arr004/Main.hs [deleted file]
ghc/lib/tests/Array/arr004/Makefile [deleted file]
ghc/lib/tests/Array/arr005/Main.hs [deleted file]
ghc/lib/tests/Array/arr005/Makefile [deleted file]
ghc/lib/tests/Array/arr006/Main.hs [deleted file]
ghc/lib/tests/Array/arr006/Makefile [deleted file]
ghc/lib/tests/Array/arr007/Main.hs [deleted file]
ghc/lib/tests/Array/arr007/Makefile [deleted file]
ghc/lib/tests/Array/arr008/Main.hs [deleted file]
ghc/lib/tests/Array/arr008/Makefile [deleted file]
ghc/lib/tests/Array/arr009/Main.hs [deleted file]
ghc/lib/tests/Array/arr009/Makefile [deleted file]
ghc/lib/tests/Array/arr010/Main.hs [deleted file]
ghc/lib/tests/Array/arr010/Makefile [deleted file]
ghc/lib/tests/Array/arr011/Main.hs [deleted file]
ghc/lib/tests/Array/arr011/Makefile [deleted file]
ghc/lib/tests/Array/arr012/Main.hs [deleted file]
ghc/lib/tests/Array/arr012/Makefile [deleted file]
ghc/tests/array/should_run/arr012.stdout [new file with mode: 0644]

diff --git a/ghc/lib/tests/Array/arr001/Main.hs b/ghc/lib/tests/Array/arr001/Main.hs
deleted file mode 100644 (file)
index 4785170..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
--- Simple array creation
-
-import Array
-
-main =
- let a1 = array (1,3) (zip [2,3,1] ['a'..'d']) in
- print a1
-
--- Result:
diff --git a/ghc/lib/tests/Array/arr001/Makefile b/ghc/lib/tests/Array/arr001/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr002/Main.hs b/ghc/lib/tests/Array/arr002/Main.hs
deleted file mode 100644 (file)
index fd3bf7e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
--- Array creation, (index,value) list with duplicates.
--- 
--- Haskell library report 1.3 (and earlier) specifies
--- that `array' values created with lists containing dups,
--- are undefined ( _|_ ).
---
--- GHC-2.02 (and earlier) does not flag this as such, the
--- last (index,value) is instead used.
---
--- The report also specifies `array' is spine strict in
--- the (index,value) list argument and to check the
--- validity of the index values upon creation, it also
--- strict for the indices. To test this, we do (a!1)
--- twice, expecting to see the same value..
---
-import Array
-
-main =
- let a1 = array (1,3) (zip (1:[1..3]) ['a'..'d']) in
- print (a1!1) >>
- print a1     >>
- print (a1!1)
-
diff --git a/ghc/lib/tests/Array/arr002/Makefile b/ghc/lib/tests/Array/arr002/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr003/Main.hs b/ghc/lib/tests/Array/arr003/Main.hs
deleted file mode 100644 (file)
index 0dbe42b..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
--- Array creation, (index,value) list with out of bound index.
--- 
--- Haskell library report 1.3 (and earlier) specifies
--- that `array' values created with lists containing out-of-bounds indices,
--- are undefined ( _|_ ).
---
--- GHC implementation of `array' catches this (or, rather, 
--- `index' does) - the argument list to `array' is defined
--- to have its spine be evaluated - so the indexing below
--- should cause a failure.
---
-import Array
-
-main =
- let a1 = array (1,3) (zip ([1..4]) ['a'..'d']) in
- print (a1!2)
-
-
-
diff --git a/ghc/lib/tests/Array/arr003/Makefile b/ghc/lib/tests/Array/arr003/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr004/Main.hs b/ghc/lib/tests/Array/arr004/Main.hs
deleted file mode 100644 (file)
index 5a12834..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
--- Array - accessing undefined element
--- 
--- Sample Haskell implementation in the 1.3 Lib report defines
--- this as being undefined/error.
-
-import Array
-
-main =
- let a1 = array (1,3) (zip ([1,2]) ['a'..'d']) in
- print (a1!3)
-
--- output: Fail: (Array.!): undefined array element
-
-
-
diff --git a/ghc/lib/tests/Array/arr004/Makefile b/ghc/lib/tests/Array/arr004/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr005/Main.hs b/ghc/lib/tests/Array/arr005/Main.hs
deleted file mode 100644 (file)
index 6d531cd..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
--- Array - recurrences
--- 
--- array does not evaluate the elements.
---
-import Array
-
-main =
- let 
-  a1 = array (1,100) ((1,1::Integer):[(i,i*a1!(i-1))|i<-[2..100]])
- in
- print a1
-
---
-
-
-
diff --git a/ghc/lib/tests/Array/arr005/Makefile b/ghc/lib/tests/Array/arr005/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr006/Main.hs b/ghc/lib/tests/Array/arr006/Main.hs
deleted file mode 100644 (file)
index 95abb1c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
--- Array - empty arrays
--- 
--- print a couple of them to try to expose empty arrays 
--- to a GC or two.
-import Array
-
-main =
- let 
-  a1 = array (1,0) []
- in
- print (take 300 $ repeat (a1 :: Array Int Int))
diff --git a/ghc/lib/tests/Array/arr006/Makefile b/ghc/lib/tests/Array/arr006/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr007/Main.hs b/ghc/lib/tests/Array/arr007/Main.hs
deleted file mode 100644 (file)
index e3e4ba0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
--- Array - accessing empty arrays
--- 
--- empty arrays are legal, but indexing them is undefined!
---
-import Array
-
-main =
- let 
-  a1 = array (1,0) [(1,'a')]
- in
- print (a1!0)
diff --git a/ghc/lib/tests/Array/arr007/Makefile b/ghc/lib/tests/Array/arr007/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr008/Main.hs b/ghc/lib/tests/Array/arr008/Main.hs
deleted file mode 100644 (file)
index c066cdd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
--- Array - out-of-range (index,value) pairs
--- 
--- supplying a list containing one or more pairs 
--- with out-of-range index is undefined.
---
---
-import Array
-
-main = 
- let 
-  a1 = array (1,0) []
-  a2 = array (0,1) (zip [0..] ['a'..'z'])
- in
- print (a1::Array Int Int) >> print a2
diff --git a/ghc/lib/tests/Array/arr008/Makefile b/ghc/lib/tests/Array/arr008/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr009/Main.hs b/ghc/lib/tests/Array/arr009/Main.hs
deleted file mode 100644 (file)
index a6fe26e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
--- Array - derived ops
--- 
--- testing the well-behavedness of 
--- derived ops for empty and non-empty arrays
---
-import Array
-
-main = 
- let 
-  a1 = array (1,0) ([]::[(Int,Int)])
-  a2 = array (1,26) (zip [1..] ['a'..'z'])
-
-  dump a = (bounds a, indices a, elems a, assocs a)
- in
- print (dump a1) >>
- print (dump a2)
-
diff --git a/ghc/lib/tests/Array/arr009/Makefile b/ghc/lib/tests/Array/arr009/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr010/Main.hs b/ghc/lib/tests/Array/arr010/Main.hs
deleted file mode 100644 (file)
index 2952bec..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
---
--- Array - accumulated arrays
--- 
---
-module Main(main) where
-
-import Array
-import Ix
-
-hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b
-hist bnds is = accumArray (+) 0 bnds [(i,1) | i <- is , inRange bnds i]
-
-main = 
- let 
-  a1 = hist (0,10) (concat $ take 2 $ repeat [1..20])
- in
- print a1
-
-
diff --git a/ghc/lib/tests/Array/arr010/Makefile b/ghc/lib/tests/Array/arr010/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr011/Main.hs b/ghc/lib/tests/Array/arr011/Main.hs
deleted file mode 100644 (file)
index 76ad178..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
--- Array - array difference operator
--- 
---
-module Main(main) where
-
-import Array
-import Ix
-
-hist :: (Ix a, Num b) => (a,a) -> [a] -> Array a b
-hist bnds is = accumArray (+) 0 bnds [(i,1) | i <- is , inRange bnds i]
-
-main = 
- let 
-  a1 = hist (0,10) (concat $ take 2 $ repeat [1..20])
- in
- print a1 >>
- print (a1 // [ (i,0) | i<-[0..10], odd i])
-
-
-
diff --git a/ghc/lib/tests/Array/arr011/Makefile b/ghc/lib/tests/Array/arr011/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/lib/tests/Array/arr012/Main.hs b/ghc/lib/tests/Array/arr012/Main.hs
deleted file mode 100644 (file)
index 61dc0bf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
--- Array map operations
--- 
---
-module Main(main) where
-
-import Array
-import Char
-
-main = 
- let 
-  a1 = array (0,10) (zip [0..10] ['a'..'z'])
- in
- print a1 >>
- print (map (toUpper) a1) >>
- print (ixmap (3,8) (+1) a1)
-
-
-
-
diff --git a/ghc/lib/tests/Array/arr012/Makefile b/ghc/lib/tests/Array/arr012/Makefile
deleted file mode 100644 (file)
index f66958d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TOP=../../../..
-include $(TOP)/mk/boilerplate.mk
-include $(TOP)/mk/target.mk
diff --git a/ghc/tests/array/should_run/arr012.stdout b/ghc/tests/array/should_run/arr012.stdout
new file mode 100644 (file)
index 0000000..599902d
--- /dev/null
@@ -0,0 +1,3 @@
+array (0, 10) [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd'), (4, 'e'), (5, 'f'), (6, 'g'), (7, 'h'), (8, 'i'), (9, 'j'), (10, 'k')]
+array (0, 10) [(0, 'A'), (1, 'B'), (2, 'C'), (3, 'D'), (4, 'E'), (5, 'F'), (6, 'G'), (7, 'H'), (8, 'I'), (9, 'J'), (10, 'K')]
+array (3, 8) [(3, 'e'), (4, 'f'), (5, 'g'), (6, 'h'), (7, 'i'), (8, 'j')]