Commit 96012cec authored by Bas Lijnse's avatar Bas Lijnse

Renamed 'split' to 'splitRandomStream', because of conflict with 'split' in...

Renamed 'split' to 'splitRandomStream', because of conflict with 'split' in Text from clean-platform
parent 1ae45de6
......@@ -42,7 +42,7 @@ instance /\ Property Property
where (/\) x y = Prop (and x y)
where
and x y rs r
# (rs2,rs) = split rs
# (rs2,rs) = splitRandomStream rs
r1 = testAnalysis r (evaluate x rs r)
r2 = testAnalysis r (evaluate y rs2 r)
= case (r1.res,r2.res) of // collect labels !!
......@@ -80,7 +80,7 @@ instance \/ Property Property
where (\/) x y = Prop (or x y)
where
or x y rs r
# (rs2,rs) = split rs
# (rs2,rs) = splitRandomStream rs
= case testAnalysis r (evaluate x rs r) of
r=:{res=OK} = [r]
r=:{res=Pass} = case testAnalysis r (evaluate y rs2 r) of
......@@ -106,7 +106,7 @@ where p rs r = [exists r [testAnalysis r (evaluate (f a) rs r)\\a <- l] MaxExist
Exists :: (x->p) -> Property | Testable p & TestArg x
Exists f = Prop p
where p rs r
# (rs,rs2) = split rs
# (rs,rs2) = splitRandomStream rs
= [exists r [testAnalysis r (evaluate (f a) rs2 r)\\a <- generateAll rs] MaxExists]
exists r [] n = {r & res = CE}
exists r _ 0 = {r & res = Undef}
......@@ -164,7 +164,7 @@ where VOOR (PL fl) l = diagonal [map f l\\f<-fl] //[f x \\ f<-fl, x<-l]
(ForAndGen) infixl 0 :: !(x->p) ![x] -> Property | Testable p & TestArg x
(ForAndGen) p list = Prop (evaluate p)
where evaluate f rs result
# (rs,rs2) = split rs
# (rs,rs2) = splitRandomStream rs
= forAll f (list++generateAll rs) rs2 result
classify :: !Bool l !p -> Property | Testable p & genShow{|*|} l
......
......@@ -48,10 +48,10 @@ aStream :: RandomStream
//--- for implementation of properties ---//
diagonal :: [[a]] -> [a]
forAll :: !(a->b) ![a] RandomStream !Admin -> [Admin] | Testable b & TestArg a
split :: !RandomStream -> (RandomStream,RandomStream)
generateAll :: !RandomStream -> [a] | ggen{|*|} a
diagonal :: [[a]] -> [a]
forAll :: !(a->b) ![a] RandomStream !Admin -> [Admin] | Testable b & TestArg a
splitRandomStream :: !RandomStream -> (RandomStream,RandomStream)
generateAll :: !RandomStream -> [a] | ggen{|*|} a
//--- testing --//
......
......@@ -33,7 +33,7 @@ where evaluate (Prop p) rs result = p rs result
instance Testable (a->b) | Testable b & TestArg a
where evaluate f rs admin
# (rs,rs2) = split rs
# (rs,rs2) = splitRandomStream rs
= forAll f (generateAll rs) rs2 admin
instance Testable [a] | Testable a
......@@ -73,11 +73,11 @@ derive bimap [], (,), (,,), (,,,), (,,,,), (,,,,,)
//--- Random ---//
split :: !RandomStream -> (RandomStream,RandomStream)
split [r,s:rnd]
splitRandomStream :: !RandomStream -> (RandomStream,RandomStream)
splitRandomStream [r,s:rnd]
# seed = r*s
| seed==0
= split rnd
= splitRandomStream rnd
= (rnd, genRandInt seed)
(>>=) infix 0 :: (a -> (b,a)) (b a -> d) -> a -> d
......
Markdown is supported
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