Skip to content

Commit

Permalink
tests pass in ghc
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoerzen committed Sep 12, 2007
1 parent 7642a40 commit 56d7870
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 4 additions & 1 deletion testsrc/TestInfrastructure.hs
Expand Up @@ -136,10 +136,13 @@ w msg f = case f of
t :: forall f t i. (TestLL f i, Arbitrary f, Arbitrary i, Show f, Eq f, Testable t) => (f -> t) -> LLTest f i
t = LLTest

-- | all props, wrapped list
apw :: forall f i t. (TestLL f i, Show i, Eq i, LL.ListLike f i, Eq f, Show f, Arbitrary f, Arbitrary i, Testable t) => String -> (forall f'. (LL.ListLike f' f, TestLL f' f, Show f', Eq f', Arbitrary f') => (f' -> t)) -> HU.Test
apw msg x = HU.TestLabel msg $ HU.TestList $
[w "wrap []" ((LLTest x)::LLTest [f] f),
w "wrap MyList" ((LLTest x)::LLTest (MyList f) f)]
w "wrap MyList" ((LLTest x)::LLTest (MyList f) f),
w "wrap Array" ((LLTest x)::LLTest (A.Array Int f) f)]

-- | all props, 3 args: full, full, and item
apf :: String -> (forall f i. (TestLL f i, Show i, Eq i, LL.ListLike f i, Eq f, Show f, Arbitrary f, Arbitrary i) => LLTest f i) -> HU.Test
apf msg x = HU.TestLabel msg $ HU.TestList $
Expand Down
20 changes: 9 additions & 11 deletions testsrc/runtests.hs
Expand Up @@ -55,12 +55,12 @@ prop_map f func = llcmp llmap (map func (LL.toList f))
prop_rigidMap f func = llcmp (LL.rigidMap func f) (map func (LL.toList f))
prop_reverse f = llcmp (LL.reverse f) (reverse (LL.toList f))
prop_intersperse f i = llcmp (LL.intersperse i f) (intersperse i (LL.toList f))
prop_concat :: (LL.ListLike full item, TestLL full item,
LL.ListLike f' full, TestLL f' full) =>
full -> f' -> Result
prop_concat f f2 =
llcmp llres (concat (LL.map LL.toList f2))
where llres = asTypeOf (LL.concat f2) f

--prop_concat :: (TestLL full item, LL.ListLike full' full) => full' -> Result
prop_concat :: (TestLL full [Int], LL.ListLike full [Int]) => full -> Result
prop_concat f =
llcmp (LL.concat f) (concat (LL.toList f))
--(LL.toList (LL.concat f)) == (concat (LL.toList f))

allt = [apf "empty" (t prop_empty),
apf "length" (t prop_length),
Expand All @@ -78,14 +78,12 @@ allt = [apf "empty" (t prop_empty),
apf "map" (t prop_map),
apf "rigidMap" (t prop_rigidMap),
apf "reverse" (t prop_reverse),
apf "intersperse" (t prop_intersperse)
--apf "concat" (t prop_concat)
apf "intersperse" (t prop_intersperse),
apw "concat" (prop_concat)
]

testh = runTestTT (TestList allt)

main =
do printf "Running %d test functions * %d types under test = %d cases\n"
(length allt) (12::Int) (12 * length allt)
testh
do testh
return ()

0 comments on commit 56d7870

Please sign in to comment.