--- /dev/null
+module matcher_deep\r
+\r
+import StdEnv\r
+\r
+:: MatchResult :== [(String, Bool)]\r
+\r
+:: MatchExp a = Is (MatchExp a)\r
+ | Not (MatchExp a)\r
+ | EqualTo a\r
+ | LessThen a\r
+ | Or infixl 2 (MatchExp a) (MatchExp a)\r
+\r
+AssertThat :: String a (MatchExp a) MatchResult -> MatchResult | == a & < a\r
+AssertThat id x (Is exp) res = AssertThat id x exp res\r
+AssertThat id x (Not exp) res = [(id, not r):res] where\r
+ [(_, r):_] = AssertThat id x exp []\r
+AssertThat id x (EqualTo y) res = [(id, x == y):res]\r
+AssertThat id x (LessThen y) res = [(id, x < y):res]\r
+AssertThat id x (y Or z) res = [(id, ry || rz):res] where\r
+ [(_,ry):_] = AssertThat id x y []\r
+ [(_,rz):_] = AssertThat id x z []\r
+\r
+test :: (MatchResult -> MatchResult) -> [String]\r
+test f = ["pass=" : toString pass : " fail=" : toString (length res-pass) : "\n" : print res []] where \r
+ res = f []\r
+ pass = foldl (\c (_, r) . if r (c+1) c) 0 res\r
+\r
+instance * (MatchResult -> MatchResult) where\r
+ (*) x y = \res . x (y res)\r
+\r
+print :: MatchResult [String] -> [String]\r
+print [] xs = xs\r
+print [(id, r):rs] xs = [id : " " : (state r) : "\n" : print rs xs] where\r
+ state True = "PASS"\r
+ state False = "FAIL"\r
+\r
+a1 = AssertThat "(2*2) (Is (EqualTo (2+2)))" (2*2) (Is(EqualTo (2+2)))\r
+a2 = AssertThat "(3*3) (EqualTo (3+3))" (3*3) (EqualTo (3+3))\r
+a3 = AssertThat "(length [0..3]) is not 4" (length [0..3]) (Not(EqualTo 4))\r
+\r
+report = test (a1*a2*a3)\r
+\r
+instance <<< [String] where\r
+ (<<<) file [] = file\r
+ (<<<) file [s:ss] = file <<< s <<< ss\r
+\r
+Start :: !*World -> *World\r
+Start world\r
+ # (file, world) = stdio world\r
+ # file = file <<< report\r
+ # (ok, world) = fclose file world\r
+ | otherwise = world
\ No newline at end of file
--- /dev/null
+Version: 1.4\r
+Global\r
+ ProjectRoot: .\r
+ Target: StdEnv\r
+ Exec: {Project}\matcher_deep.exe\r
+ CodeGen\r
+ CheckStacks: False\r
+ CheckIndexes: True\r
+ Application\r
+ HeapSize: 2097152\r
+ StackSize: 512000\r
+ ExtraMemory: 81920\r
+ IntialHeapSize: 204800\r
+ HeapSizeMultiplier: 4096\r
+ ShowExecutionTime: False\r
+ ShowGC: False\r
+ ShowStackSize: False\r
+ MarkingCollector: False\r
+ StandardRuntimeEnv: True\r
+ Profile\r
+ Memory: False\r
+ MemoryMinimumHeapSize: 0\r
+ Time: False\r
+ Stack: False\r
+ Output\r
+ Output: ShowConstructors\r
+ Font: Courier\r
+ FontSize: 9\r
+ WriteStdErr: False\r
+ Link\r
+ LinkMethod: Static\r
+ GenerateRelocations: False\r
+ GenerateLinkMap: False\r
+ LinkResources: False\r
+ ResourceSource: \r
+ GenerateDLL: False\r
+ ExportedNames: \r
+ Paths\r
+ Path: {Project}\r
+ Precompile: \r
+ Postlink: \r
+MainModule\r
+ Name: matcher_deep\r
+ Dir: {Project}\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+OtherModules\r
+ Module\r
+ Name: StdArray\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdBool\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdChar\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdCharList\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdClass\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdEnum\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdEnv\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdFile\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdFunc\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdInt\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdList\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdMisc\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdOrdList\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdOverloaded\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdReal\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdString\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: StdTuple\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: _SystemArray\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r
+ Module\r
+ Name: _SystemEnum\r
+ Dir: {Application}\Libraries\StdEnv\r
+ Compiler\r
+ NeverMemoryProfile: False\r
+ NeverTimeProfile: False\r
+ StrictnessAnalysis: True\r
+ ListTypes: StrictExportTypes\r
+ ListAttributes: True\r
+ Warnings: True\r
+ Verbose: True\r
+ ReadableABC: False\r
+ ReuseUniqueNodes: True\r
+ Fusion: False\r