-
Notifications
You must be signed in to change notification settings - Fork 8
/
clpsmt-basic-tests.scm
70 lines (61 loc) · 1.23 KB
/
clpsmt-basic-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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
(test "counters"
(let ((c1 z3-counter-check-sat)
(c2 z3-counter-get-model))
(run* (q)
(z/assert `(= ,q 0)))
(list
(- z3-counter-check-sat c1)
(- z3-counter-get-model c2)))
'(4 1))
(test "declare-idempotent"
(run* (q)
(fresh (v1 v2)
(z/ `(declare-const ,v1 Bool))
(z/ `(declare-const ,v2 Bool))
(== v1 v2)
(== q v1)))
'(_.0))
(test "inf-smt-ans-1"
(run 1 (q)
(z/assert `(>= ,q 0)))
'(0))
(test "inf-smt-ans-2"
(run 2 (q)
(z/assert `(>= ,q 0)))
'(0 1))
(test "1"
(run* (q)
(fresh (x)
(z/assert `(= ,x 0))))
'(_.0))
(test "2"
(run* (q)
(fresh (x)
(z/assert `(= ,x 0))
(z/assert `(= ,x 1))))
'())
(test "3"
(run* (q)
(fresh (x)
(z/assert `(= ,x 0))
(== x q)))
'(0))
(test "4"
(run* (q)
(z/assert `(= ,q 0)))
'(0))
(test "5"
(run 2 (f)
(z/ `(declare-fun ,f (Int) Int))
(z/assert `(= 1 (,f 1)))
(z/assert `(= 0 (,f 0))))
;; TODO:
;; what do we really want here? syntax lambda or actual lambda?
'((lambda (x!0) (ite (= x!0 1) 1 (ite (= x!0 0) 0 1)))))
(test "6"
(run 1 (q)
(fresh (f x)
(z/ `(declare-fun ,f (Int) Int))
(z/assert `(= ,x (,f ,x)))
(== q x)))
'(0))