3 /* Test module StdStack
5 (*) gebruik Environment 'Gast'
6 (*) zet Project Options op 'Basic Values Only' en '2M' Maximum Heap Size
21 pop_maakt_stack_korter n /\
25 newStack_is_empty :: Property
26 newStack_is_empty = name "newStack_is_empty" (isEmpty (elements empty))
28 stack_is_reverse :: Int -> Property
29 stack_is_reverse n = name "stack_is_reverse"
30 (elements (pushes [1..n`] newStack) == reverse [1..n`])
31 where n` = min (abs n) 100
33 pop_empty_is_ok :: Property
34 pop_empty_is_ok = name "pop_empty_is_ok" (count (pop empty) == 0)
36 top_na_push :: Int Int -> Property
37 top_na_push x n = name "top_na_push"
38 (top (push x (pushes [1..n`] newStack)) == x)
39 where n` = min (abs n) 100
41 pop_na_push :: Int -> Property
42 pop_na_push a = name "pop_na_push"
43 (top (pop (pop (pushes [a,b,c] newStack))) == a)
47 count_counts :: Int Int -> Property
48 count_counts n x = name "count_counts"
49 (length (elements stack) == count stack)
50 where stack = pushes [1..n`] newStack
53 pop_maakt_stack_korter :: Int -> Property
54 pop_maakt_stack_korter n = name "pop_maakt_stack_korter"
55 (count stack == 0 || count (pop stack) == count stack - 1)
56 where stack = pushes [1..n`] newStack