Commit 7f12c181 authored by nx200's avatar nx200
Browse files

added new tests to esc

parent 499f2f22
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
1. Compile each new example as follows to obtain the .stderr file.
../../../../ghc/compiler/ghc-inplace -no-recomp -dcore-lint -Di386_unknown_mi
ngw32 -c f0.hs -O -farity -ddump-idinfo >f0.stderr 2>&1
2. Add one more line to all.T for each new example.
3. make
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
# Only compile with optimisation
setTestOpts( only_ways(['opt']) )
test('head', normal, compile, ['-fesc -ddump-esc'])
test('sum', normal, compile, ['-fesc -ddump-esc'])
test('dataA', normal, compile, ['-fesc -ddump-esc'])
module DataA where
data A a = B a | C a Int
{-# CONTRACT g :: A {x | x>0} -> any #-}
g :: A Int -> Int
g (B x) = x
module Head where
(==>) True x = True
(==>) False x = True
and1 True x = x
and1 False x = False
{-# CONTRACT head1 :: {xs | not (null xs)} -> any #-}
-- {-# CONTRACT head1 :: {xs | not1 (null1 xs)} -> {r | r > 0} #-}
head1 :: [Int] -> Int
head1 (x:xs) = x
not1 True = False
not1 False = True
null1 [] = True
null1 xs = False
res1 = and1 True True
{-# CONTRACT res2 :: any #-}
res2 = head1 [5]
module Sum where
-- {-# SPECIALISE f :: Int -> Int #-}
-- {-# CONTRACT f :: x:{y | y > 0} -> {r | r == x + 1} #-}
-- {-# CONTRACT f :: x:{y | y > 0} -> {y | y > 0} -> {r | r == x + 1} #-}
-- {-# CONTRACT f :: any -> {y | y > 0} #-}
-- {-# CONTRACT f :: {y | y > 0} -> any #-}
{-# CONTRACT f :: x:{y | y > 0} -> {r | r > 0} #-}
f :: Int -> Int
f x = x + 1
-- {-# CONTRACT f2 :: x:{y | y > 0} -> {y | y > x} -> {r | r > 0} #-}
{-# CONTRACT f2 :: x:{y | y > 0} -> {y | y > x} -> any #-}
f2 :: Int -> Int -> Int
f2 x y = x + y
t1 = f 5
t2a = f2 (f 5) 2
t2b = f2 (f 5) 6
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment