2021-04-09 00:01:27 +02:00
|
|
|
(plan 12)
|
|
|
|
|
2021-04-02 16:20:15 +02:00
|
|
|
;; Constants
|
|
|
|
|
|
|
|
(expect "True is true" (eq 1 (if t 1 0)))
|
2021-04-05 00:06:49 +02:00
|
|
|
(expect "False is false" (eq 1 (if nil 0 1)))
|
2021-04-02 16:20:15 +02:00
|
|
|
|
2021-04-05 00:06:49 +02:00
|
|
|
(expect "not f == t" (not nil))
|
2021-04-02 16:20:15 +02:00
|
|
|
(expect "not t == f" (eq 1 (if (not t) 0 1)))
|
|
|
|
|
|
|
|
;; operator and
|
|
|
|
|
|
|
|
(expect "and operator: t && t == t"
|
|
|
|
(and t t))
|
|
|
|
|
|
|
|
(expect "and operator: t && f == f"
|
2021-04-05 00:06:49 +02:00
|
|
|
(not (and t nil)))
|
|
|
|
|
|
|
|
(expect "and operator: f && t == f"
|
|
|
|
(not (and nil t)))
|
2021-04-02 16:20:15 +02:00
|
|
|
|
|
|
|
(expect "and operator: f && f == f"
|
2021-04-05 00:06:49 +02:00
|
|
|
(not (and nil nil)))
|
2021-04-02 16:20:15 +02:00
|
|
|
|
|
|
|
;; operator or
|
|
|
|
(expect "or operator: t || t == t"
|
|
|
|
(or t t))
|
|
|
|
|
|
|
|
(expect "or operator: t || f == t"
|
2021-04-05 00:06:49 +02:00
|
|
|
(or t nil))
|
|
|
|
|
|
|
|
(expect "or operator: f || t == t"
|
|
|
|
(or nil t))
|
2021-04-02 16:20:15 +02:00
|
|
|
|
|
|
|
(expect "or operator: f || f == f"
|
2021-04-05 00:06:49 +02:00
|
|
|
(not (or nil nil)))
|