Coverage report: /home/runner/work/geb/geb/test/lambda-trans.lisp
Kind | Covered | All | % |
expression | 455 | 678 | 67.1 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
3
(define-test geb.lambda.trans
4
:parent geb-test-suite)
8
(lambda:right so1 (lambda:unit))
9
(lambda:left so1 (lambda:unit))))
11
(def lambda-not-with-lambda
13
(list (coprod so1 so1))
14
(lambda:case-on (lambda:index 0)
15
(lambda:lamb (list so1) (lambda:right so1 (lambda:unit)))
16
(lambda:lamb (list so1) (lambda:left so1 (lambda:unit))))))
18
(def lambda-not-without-lambda
20
(list (coprod so1 so1))
21
(lambda:case-on (lambda:index 0)
22
(lambda:right so1 (lambda:unit))
23
(lambda:left so1 (lambda:unit)))))
27
(list (coprod so1 so1))
28
(lambda:case-on (lambda:index 0)
29
(lambda:right so1 (lambda:index 0))
30
(lambda:left so1 (lambda:index 0)))))
33
(lambda:lamb (list geb-bool:bool)
34
(lambda:pair (lambda:right so1 (lambda:index 0))
35
(lambda:left so1 (lambda:index 0)))))
38
(lambda:lamb (list (coprod so1 so1)) (geb.lambda:index 0)))
41
(lambda:case-on (lambda:left so1 (lambda:unit))
46
(lambda:case-on (lambda:left so1 (lambda:unit))
51
(lambda:case-on (lambda:err (coprod so1 so1))
55
(def context-dependent-case
56
(lambda:case-on (lambda:index 0)
61
(lambda:bit-choice 1))
64
(lambda:lamb (list (nat-width 24)) (lambda:plus (lambda:index 0)
67
(lambda:lamb (list (nat-width 24)) (lambda:minus (lambda:index 0)
70
(def less-than-1 (lambda:lamb (list (nat-width 24))
71
(lambda:case-on (lambda:lamb-lt (lambda:index 0)
74
(lambda:bit-choice 1))))
75
(def is-1 (lambda:lamb (list (nat-width 24))
76
(lambda:case-on (lambda:lamb-eq (lambda:index 0)
79
(lambda:bit-choice 1))))
84
(lambda:left so1 (lambda:unit))
85
(lambda:lamb (list so1) (lambda:right so1 (lambda:unit)))
86
(lambda:lamb (list so1) (lambda:left so1 (lambda:unit))))
89
(defparameter *issue-94-circuit*
90
(lambda:app (lambda:lamb (list (lambda:fun-type
91
(lambda:fun-type (coprod so1 so1)
94
(lambda:app (lambda:index 0)
95
(list (lambda:lamb (list (coprod so1 so1))
97
(list (lambda:lamb (list (lambda:fun-type (coprod so1 so1)
99
(lambda:left so1 (lambda:unit))))))
102
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
103
;; Interpreter tests ;;
104
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106
(define-test lambda.trans-eval :parent geb.lambda.trans)
108
(define-test lambda.case-works-as-expected :parent lambda.trans-eval
109
(is equalp #*0 (gapply (to-bitc lambda-not-with-lambda) #*1))
110
(is equalp #*1 (gapply (to-bitc lambda-not-with-lambda) #*0))
112
(gapply (to-bitc lambda-not-without-lambda) #*0)
113
(gapply (to-bitc lambda-not-with-lambda) #*0))
115
(gapply (to-bitc lambda-not-without-lambda) #*1)
116
(gapply (to-bitc lambda-not-with-lambda) #*1))
117
(is equalp (list 0 0) (gapply (to-seqn lambda-not-with-lambda) (list 1 0 0)))
118
(is equalp (list 1 0) (gapply (to-seqn lambda-not-with-lambda) (list 0 0 0)))
119
(is equalp (gapply (to-seqn lambda-not-without-lambda) (list 0 0 0))
120
(gapply (to-seqn lambda-not-with-lambda) (list 0 0 0)))
121
(is equalp (gapply (to-seqn lambda-not-without-lambda) (list 1 0 0))
122
(gapply (to-seqn lambda-not-with-lambda) (list 1 0 0))))
124
(define-test lambda.preserves-pair :parent lambda.trans-eval
126
(list (right (right so1))
128
(gapply (to-cat nil lambda-pairing) (list (right so1) so1))))
131
(define-test gapply-bool-id :parent lambda.trans-eval
136
(list (right so1) so1)))
141
(list (left so1) so1)))
142
(is obj-equalp #*0 (gapply (to-bitc bool-id) #*0))
143
(is obj-equalp #*1 (gapply (to-bitc bool-id) #*1))
144
(is obj-equalp (list 0 0) (gapply (to-seqn bool-id) (list 0 0 0)))
145
(is obj-equalp (list 1 0) (gapply (to-seqn bool-id) (list 1 0 0))))
147
(define-test lambda.not-works :parent lambda.trans-eval
148
(is obj-equalp (left so1) (gapply (to-cat nil proper-not)
149
(list (geb:right so1) so1)))
150
(is obj-equalp (right so1) (gapply (to-cat nil proper-not)
151
(list (geb:left so1) so1)))
152
(is equalp #*0 (gapply (to-bitc proper-not) #*1))
153
(is equalp #*1 (gapply (to-bitc proper-not) #*0))
154
(is equalp (list 0 0) (gapply (to-seqn proper-not) (list 1 0 0)))
155
(is equalp (list 1 0) (gapply (to-seqn proper-not) (list 0 0 0))))
157
(define-test error-handling-case :parent lambda.trans-eval
158
(is obj-equalp (left so1) (gapply (to-cat nil case-error-left)
160
(is obj-equalp (right so1) (gapply (to-cat nil case-error-right)
162
(is obj-equalp (left so1) (gapply (to-cat nil case-error-top)
164
(is obj-equalp (left so1) (gapply (to-cat (list (coprod so1 so1))
165
context-dependent-case)
168
(is obj-equalp (right so1) (gapply (to-cat (list (coprod so1 so1))
169
context-dependent-case)
173
(define-test arithmetic-compilation :parent lambda.trans-eval
174
(is obj-equalp 1 (gapply (to-cat nil plus-one) (list 0 so1)))
175
(is obj-equalp 2 (gapply (to-cat nil plus-one) (list 1 so1)))
176
(is obj-equalp (list 1) (gapply (to-seqn plus-one) (list 0 0)))
177
(is obj-equalp (list 2) (gapply (to-seqn plus-one) (list 1 0)))
178
(is obj-equalp 0 (gapply (to-cat nil less-than-1) (list 0 so1)))
179
(is obj-equalp 1 (gapply (to-cat nil less-than-1) (list 1 so1)))
180
(is obj-equalp (list 0) (gapply (to-seqn less-than-1) (list 0 so1)))
181
(is obj-equalp (list 1) (gapply (to-seqn less-than-1) (list 1 so1)))
182
(is obj-equalp 0 (gapply (to-cat nil is-1) (list 1 so1)))
183
(is obj-equalp 1 (gapply (to-cat nil is-1) (list 0 so1)))
184
(is obj-equalp (list 0) (gapply (to-seqn is-1) (list 1 so1)))
185
(is obj-equalp (list 1) (gapply (to-seqn is-1) (list 0 so1))))
187
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
188
;; Compile checked term tests ;;
189
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
191
(define-test compile-checked-term :parent geb.lambda.trans
193
(to-cat nil (lambda:unit))
197
(define-test stlc-ctx-to-mu :parent compile-checked-term
199
(lambda:stlc-ctx-to-mu nil)
201
"compile in a nil context"))
203
(define-test fold-singleton-unit-context :parent compile-checked-term
205
(lambda:stlc-ctx-to-mu (list so1))
207
"fold singleton unit context"))
209
(define-test fold-singleton-bool-context :parent compile-checked-term
211
(lambda:stlc-ctx-to-mu (list geb-bool:bool))
212
(prod geb-bool:bool so1)
213
"fold singleton bool context"))
215
(define-test fold-multi-object-context :parent compile-checked-term
217
(lambda:stlc-ctx-to-mu (list geb-bool:bool so0 so1))
218
(prod geb-bool:bool (prod so0 (prod so1 so1)))
219
"fold multi-object context"))
221
(define-test so-hom-so1-so1 :parent compile-checked-term
223
(lambda:so-hom so1 so1)
225
"compute hom(so1,so1)"))
228
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
229
;; Vampir Extractions Tests ;;
230
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
232
;; vampir extraction tests, make better tests please.
234
(define-test lambda-vampir-test :parent geb.lambda.trans
235
(of-type list (to-circuit
236
(lambda:left so1 (lambda:unit))
237
:tc_unit_to_bool_left))
238
(of-type list (to-circuit
239
(lambda:right so1 (lambda:unit))
240
:tc_unit_to_bool_right))
241
(of-type list (to-circuit (lambda:fst pair-bool-stlc) :tc_fst_bool))
242
(of-type list (to-circuit (lambda:unit) :tc_unit_to_unit))
243
(of-type list (to-circuit (to-cat (list so0)
244
(lambda:absurd so1 (lambda:index 0)))
246
(of-type list issue-58-circuit))
248
(define-test issue-94-compiles :parent geb.lambda.trans
250
(geb.entry:compile-down :stlc t
251
:entry "geb-test::*issue-94-circuit*"