Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d602f2bd6e54b4b11aa8f37a5e25dd433fa8b4b7 >--------------------------------------------------------------- commit d602f2bd6e54b4b11aa8f37a5e25dd433fa8b4b7 Author: Simon Marlow <[email protected]> Date: Fri Jul 8 10:23:26 2011 +0100 fix up existing Dynamic/Typeable tests and add a few more >--------------------------------------------------------------- tests/ghc-regress/lib/should_run/all.T | 9 +++- tests/ghc-regress/lib/should_run/dynamic001.stdout | 44 ++++++++++---------- tests/ghc-regress/lib/should_run/dynamic002.hs | 3 - tests/ghc-regress/lib/should_run/dynamic002.stdout | 6 +-- tests/ghc-regress/lib/should_run/dynamic003.hs | 12 +++++ .../should_run/dynamic003.stdout} | 0 tests/ghc-regress/lib/should_run/dynamic004.hs | 36 ++++++++++++++++ .../dynamic004.stdout} | 0 tests/ghc-regress/lib/should_run/dynamic005.hs | 14 ++++++ .../should_run/dynamic005.stdout} | 0 10 files changed, 92 insertions(+), 32 deletions(-) diff --git a/tests/ghc-regress/lib/should_run/all.T b/tests/ghc-regress/lib/should_run/all.T index bc5e6b0..502f868 100644 --- a/tests/ghc-regress/lib/should_run/all.T +++ b/tests/ghc-regress/lib/should_run/all.T @@ -21,9 +21,12 @@ test('text001', normal, compile_and_run, ['']) test('tup001', normal, compile_and_run, ['']) test('addr001', normal, compile_and_run, ['']) -test('dynamic001', skip_if_fast, compile_and_run, ['']) -test('dynamic002', [skip_if_fast,reqlib('packedstring')], compile_and_run, ['-package packedstring']) -test('enum01', skip_if_fast, compile_and_run, ['-cpp']) +test('dynamic001', normal, compile_and_run, ['']) +test('dynamic002', normal, compile_and_run, ['']) +test('dynamic003', extra_run_opts('+RTS -K32m -RTS'), compile_and_run, ['']) +test('dynamic004', normal, compile_and_run, ['']) +test('dynamic005', normal, compile_and_run, ['']) +test('enum01', skip_if_fast, compile_and_run, ['-cpp']) test('enum02', skip_if_fast, compile_and_run, ['-cpp']) test('enum03', skip_if_fast, compile_and_run, ['-cpp']) test('enum04', normal, compile_and_run, ['']) diff --git a/tests/ghc-regress/lib/should_run/dynamic001.stdout b/tests/ghc-regress/lib/should_run/dynamic001.stdout index 83102fc..c2d365a 100644 --- a/tests/ghc-regress/lib/should_run/dynamic001.stdout +++ b/tests/ghc-regress/lib/should_run/dynamic001.stdout @@ -1,27 +1,27 @@ *** Testing: toDyn *** -[ <<GHC.Types.Int>> -, <<GHC.Types.Char>> -, <<GHC.Types.Bool>> -, <<GHC.Types.Float>> -, <<GHC.Types.Double>> -, <<GHC.Integer.Type.Integer>> -, <<GHC.Types.IO ()>> -, <<[Data.Dynamic.Dynamic]>> -, <<[GHC.Types.Int]>> -, <<Data.Maybe.Maybe GHC.Types.Int>> -, <<Data.Maybe.Maybe GHC.Types.Int>> -, <<Data.Maybe.Maybe GHC.Types.Int>> -, <<Data.Either.Either GHC.Types.Int GHC.Types.Bool>> -, <<Data.Either.Either GHC.Types.Char GHC.Types.Int>> +[ <<Int>> +, <<Char>> +, <<Bool>> +, <<Float>> +, <<Double>> +, <<Integer>> +, <<IO ()>> +, <<[Dynamic]>> +, <<[Int]>> +, <<Maybe Int>> +, <<Maybe Int>> +, <<Maybe Int>> +, <<Either Int Bool>> +, <<Either Char Int>> , <<()>> -, <<GHC.Ordering.Ordering>> -, <<((),GHC.Types.Int)>> -, <<((),GHC.Types.Int,GHC.Types.Char)>> -, <<((),GHC.Types.Int,GHC.Types.Char,GHC.Types.Double)>> -, <<((),GHC.Types.Int,GHC.Types.Char,GHC.Types.Double,(Data.Maybe.Maybe GHC.Types.Bool))>> -, <<GHC.Types.Int -> GHC.Types.Int -> GHC.Types.Int>> -, <<GHC.Integer.Type.Integer -> GHC.Integer.Type.Integer -> GHC.Integer.Type.Integer>> -, <<[GHC.Types.Char] -> [GHC.Types.Char] -> [GHC.Types.Char]>> +, <<Ordering>> +, <<((),Int)>> +, <<((),Int,Char)>> +, <<((),Int,Char,Double)>> +, <<((),Int,Char,Double,(Maybe Bool))>> +, <<Int -> Int -> Int>> +, <<Integer -> Integer -> Integer>> +, <<[Char] -> [Char] -> [Char]>> ] *** Testing: fromDyn *** 1 diff --git a/tests/ghc-regress/lib/should_run/dynamic002.hs b/tests/ghc-regress/lib/should_run/dynamic002.hs index 5dd94ab..6d53d2e 100644 --- a/tests/ghc-regress/lib/should_run/dynamic002.hs +++ b/tests/ghc-regress/lib/should_run/dynamic002.hs @@ -8,7 +8,6 @@ import Data.Array.ST import Data.Array.IO import Data.Array.Unboxed import Data.Complex -import Data.PackedString import Data.Int import Data.Word import Data.IORef @@ -63,7 +62,6 @@ main = do print (typeOf (undefined :: AsyncException)) print (typeOf (undefined :: (IOArray () ()))) print (typeOf (undefined :: (IOUArray () ()))) - print (typeOf (undefined :: PackedString)) print (typeOf (undefined :: (STArray () () ()))) print (typeOf (undefined :: (STUArray () () ()))) print (typeOf (undefined :: (StableName ()))) @@ -84,7 +82,6 @@ main = do print (typeOf (undefined :: CULLong)) print (typeOf (undefined :: CFloat)) print (typeOf (undefined :: CDouble)) - print (typeOf (undefined :: CLDouble)) print (typeOf (undefined :: CPtrdiff)) print (typeOf (undefined :: CSize)) diff --git a/tests/ghc-regress/lib/should_run/dynamic002.stdout b/tests/ghc-regress/lib/should_run/dynamic002.stdout index 629f73c..8b55566 100644 --- a/tests/ghc-regress/lib/should_run/dynamic002.stdout +++ b/tests/ghc-regress/lib/should_run/dynamic002.stdout @@ -33,11 +33,10 @@ Word8 Word16 Word32 Word64 -GHC.Exception.ArithException -GHC.IOBase.AsyncException +ArithException +AsyncException IOArray () () IOUArray () () -PackedString STArray () () () STUArray () () () StableName () @@ -57,7 +56,6 @@ CLLong CULLong CFloat CDouble -CLDouble CPtrdiff CSize CWchar diff --git a/tests/ghc-regress/lib/should_run/dynamic003.hs b/tests/ghc-regress/lib/should_run/dynamic003.hs new file mode 100644 index 0000000..fae8bdb --- /dev/null +++ b/tests/ghc-regress/lib/should_run/dynamic003.hs @@ -0,0 +1,12 @@ +module Main where + +-- Test generation of large TypeReps +-- (can be used as a benchmark) + +import Data.Typeable + +f :: Typeable a => Int -> a -> TypeRep +f 0 a = typeOf a +f n a = f (n-1) [a] + +main = print (f 50000 () == f 50001 ()) diff --git a/tests/ghc-regress/codeGen/should_run/2080.stdout b/tests/ghc-regress/lib/should_run/dynamic003.stdout similarity index 100% copy from tests/ghc-regress/codeGen/should_run/2080.stdout copy to tests/ghc-regress/lib/should_run/dynamic003.stdout diff --git a/tests/ghc-regress/lib/should_run/dynamic004.hs b/tests/ghc-regress/lib/should_run/dynamic004.hs new file mode 100644 index 0000000..e6b7a82 --- /dev/null +++ b/tests/ghc-regress/lib/should_run/dynamic004.hs @@ -0,0 +1,36 @@ +module Main where + +import Data.Typeable +import Data.Typeable.Internal +import GHC.Fingerprint +import Text.Printf + +f :: Typeable a => Int -> a -> [TypeRep] +f 0 a = [] +f n a = typeOf a : f (n-1) [a] + +-- pointwise compare 1000x1001 TypeReps, there should be exactly 1000 equalities +-- (can be used as a benchmark) +main = print $ length [ t1 | t1 <- f 1000 (), t2 <- f 1001 (), t1 == t2 ] + +{- + DEBUGGING code to help find bugs in the TypeRep implementation when + this test fails: + + where + g (x:xs) (y:ys) + | x == y = g xs ys + | otherwise = do + print x + case x of + TypeRep f1 (TyCon f2 _ _ _) [TypeRep f3 _ _] -> + printf "f1: %s\nf2: %s\nf3: %s\n" (show_fp f1) (show_fp f2) (show_fp f3) + case y of + TypeRep f1 (TyCon f2 _ _ _) [TypeRep f3 _ _] -> + printf "f1: %s\nf2: %s\nf3: %s\n" (show_fp f1) (show_fp f2) (show_fp f3) + g _ _ = return () + + show_fp :: Fingerprint -> String + show_fp (Fingerprint h l) = + printf "%x %x" h l +-} diff --git a/tests/ghc-regress/lib/Data.ByteString/bytestring002.stdout b/tests/ghc-regress/lib/should_run/dynamic004.stdout similarity index 100% copy from tests/ghc-regress/lib/Data.ByteString/bytestring002.stdout copy to tests/ghc-regress/lib/should_run/dynamic004.stdout diff --git a/tests/ghc-regress/lib/should_run/dynamic005.hs b/tests/ghc-regress/lib/should_run/dynamic005.hs new file mode 100644 index 0000000..e90aeea --- /dev/null +++ b/tests/ghc-regress/lib/should_run/dynamic005.hs @@ -0,0 +1,14 @@ +module Main where + +import Data.Typeable + +f :: Typeable a => Int -> a -> [TypeRep] +f 0 a = [] +f n a = typeOf a : f (n-1) [a] + +-- pointwise compare 1000x1000 different TypeReps, there should be no equalities +-- (can be used as a benchmark) + +main = print $ length [ t1 | t1 <- replicate 1000 (f 10 ()), + t2 <- replicate 1000 (f 10 'a'), + t1 == t2 ] diff --git a/tests/ghc-regress/codeGen/should_run/2838.stdout b/tests/ghc-regress/lib/should_run/dynamic005.stdout similarity index 100% copy from tests/ghc-regress/codeGen/should_run/2838.stdout copy to tests/ghc-regress/lib/should_run/dynamic005.stdout _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
