--- /dev/null
+definition module testable\r
+\r
+/*\r
+ GAST: A Generic Automatic Software Test-system\r
+ \r
+ testable: the test algorithm for logical properties\r
+\r
+ Pieter Koopman, 2002-2010\r
+ Radboud Universty, Nijmegen\r
+ The Netherlands\r
+ pieter@cs.ru.nl\r
+*/\r
+\r
+import genLibTest\r
+from stdProperty import ::Property // for instance of testable\r
+import gen\r
+\r
+//--- basics --//\r
+\r
+:: Admin = {labels::![String], args::![String], name::![String], res::Result}\r
+:: Result = Undef | Rej | Pass | OK | CE\r
+:: RandomStream :== [Int]\r
+\r
+derive gLess Result\r
+instance == Result\r
+\r
+:: Property = Prop (RandomStream Admin -> [Admin])\r
+\r
+prop :: a -> Property | Testable a\r
+\r
+class TestArg a | genShow{|*|}, ggen{|*|} a\r
+class Testable a where evaluate :: a RandomStream !Admin -> [Admin]\r
+\r
+instance Testable Bool\r
+instance Testable Result\r
+instance Testable Property\r
+instance Testable (a->b) | Testable b & TestArg a \r
+instance Testable [a] | Testable a \r
+\r
+//derive bimap [], (,), (,,), (,,,), (,,,,), (,,,,,)\r
+\r
+MaxExists :== 1000\r
+NrOfTest :== 1000\r
+\r
+//--- for generating lists of elements ---//\r
+\r
+aStream :: RandomStream\r
+\r
+//--- for implementation of properties ---//\r
+\r
+diagonal :: [[a]] -> [a]\r
+forAll :: !(a->b) ![a] RandomStream !Admin -> [Admin] | Testable b & TestArg a\r
+split :: !RandomStream -> (RandomStream,RandomStream)\r
+generateAll :: !RandomStream -> [a] | ggen{|*|} a\r
+\r
+//--- testing --//\r
+\r
+:: Testoption\r
+ = Tests Int\r
+ | Fails Int\r
+ | Args Int\r
+ | RandomSeed Int\r
+ | RandomList [Int]\r
+ | Verbose\r
+ | Concise\r
+ | Quiet\r
+\r
+Test :: [Testoption] !p -> [String] | Testable p\r
+TestList :: [Testoption] ![p] -> [String] | Testable p\r
+\r
+verbose :: !RandomStream !p -> [String] | Testable p\r
+verbosen :: !Int !RandomStream !p -> [String] | Testable p\r
+concise :: !RandomStream !p -> [String] | Testable p\r
+concisen :: !Int !RandomStream !p -> [String] | Testable p\r
+quiet :: !RandomStream !p -> [String] | Testable p\r
+quietn :: !Int !RandomStream !p -> [String] | Testable p\r
+quietnm :: !Int !Int !RandomStream !p -> [String] | Testable p\r
+\r
+test :: !p -> [String] | Testable p // test p NrOfTest times\r
+testn :: !Int !p -> [String] | Testable p // maxnumber of tests\r
+ttestn :: !Int !p -> [String] | Testable p // maxnumber of tests, trace all arguments\r
+testnm :: !Int !Int !p -> [String] | Testable p // maxnumber of tests, max number of errors\r
+ttestnm :: !Int !Int !p -> [String] | Testable p // maxnumber of tests, max number of errors\r