-
Notifications
You must be signed in to change notification settings - Fork 3
/
mk-tests.scm
45 lines (37 loc) · 1.28 KB
/
mk-tests.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(load "base.scm")
(load "pink.scm")
(load "mk.scm")
(load "test-check.scm")
(test "mk-1"
(evalms (list (mk '(let p ((call/fresh (lambda _ q ((== q) 5))) empty-state) (car p)))) `((,pink-eval-exp1 (var 0)) nil-env))
'((((var . 0) . 5)) . 1)
)
(test "mk-2"
(evalms (list (mk '(let p ((call/fresh (lambda _ q ((== q) 5))) empty-state) (cdr p)))) `((,pink-eval-exp1 (var 0)) nil-env))
'()
)
(define a-and-b
'((conj
(call/fresh (lambda _ a ((== a) 7))))
(call/fresh
(lambda _ b
((disj
((== b) 5))
((== b) 6)))))
)
(test "mk-3"
(evalms (list (mk `(let p (,a-and-b empty-state) (car p)))) `((,pink-eval-exp1 (var 0)) nil-env))
'((((var . 1) . 5) ((var . 0) . 7)) . 2)
)
(test "mk-3"
(evalms (list (mk `(let p (,a-and-b empty-state) (car (cdr p))))) `((,pink-eval-exp1 (var 0)) nil-env))
'((((var . 1) . 6) ((var . 0) . 7)) . 2)
)
(test "mk-4"
(evalms (list (mk `(let p (,a-and-b empty-state) (cdr (cdr p))))) `((,pink-eval-exp1 (var 0)) nil-env))
'()
)
(test "mk-compiled"
(let ((p (evalms (list (mk `(clambda _ _ (,a-and-b empty-state)))) `((,pink-eval-exp1 (var 0)) nil-env)))) (evalms (list p) '((var 0) 0)))
(let ((p (evalms (list (mk `(lambda _ _ (,a-and-b empty-state)))) `((,pink-eval-exp1 (var 0)) nil-env)))) (evalms (list p) '((var 0) 0)))
)