+module StdStackTest\r
+\r
+/* Test module StdStack\r
+ Voor werken met Gast: \r
+ (*) gebruik Environment 'Gast'\r
+ (*) zet Project Options op 'Basic Values Only' en '2M' Maximum Heap Size\r
+*/\r
+\r
+import gast\r
+import StdStack\r
+\r
+Start\r
+ = testn 1000\r
+ (\x n ->\r
+ newStack_is_empty /\\r
+ stack_is_reverse n /\\r
+ pop_empty_is_ok /\\r
+ top_na_push n x /\\r
+ pop_na_push x /\\r
+ count_counts n x /\\r
+ pop_maakt_stack_korter n /\\r
+ True\r
+ )\r
+\r
+newStack_is_empty :: Property\r
+newStack_is_empty = name "newStack_is_empty" (isEmpty (elements empty))\r
+\r
+stack_is_reverse :: Int -> Property\r
+stack_is_reverse n = name "stack_is_reverse"\r
+ (elements (pushes [1..n`] newStack) == reverse [1..n`])\r
+where n` = min (abs n) 100\r
+\r
+pop_empty_is_ok :: Property\r
+pop_empty_is_ok = name "pop_empty_is_ok" (count (pop empty) == 0)\r
+\r
+top_na_push :: Int Int -> Property\r
+top_na_push x n = name "top_na_push"\r
+ (top (push x (pushes [1..n`] newStack)) == x)\r
+where n` = min (abs n) 100\r
+\r
+pop_na_push :: Int -> Property\r
+pop_na_push a = name "pop_na_push"\r
+ (top (pop (pop (pushes [a,b,c] newStack))) == a)\r
+where b = a + a + one\r
+ c = b + a + one\r
+\r
+count_counts :: Int Int -> Property\r
+count_counts n x = name "count_counts"\r
+ (length (elements stack) == count stack)\r
+where stack = pushes [1..n`] newStack\r
+ n` = min (abs n) 100\r
+\r
+pop_maakt_stack_korter :: Int -> Property\r
+pop_maakt_stack_korter n = name "pop_maakt_stack_korter"\r
+ (count stack == 0 || count (pop stack) == count stack - 1)\r
+where stack = pushes [1..n`] newStack\r
+ n` = min (abs n) 100\r
+\r
+empty :: Stack Int\r
+empty = newStack\r