Minilisp.pm/t/bool.t
2021-04-09 00:01:27 +02:00

36 lines
704 B
Raku

(plan 12)
;; Constants
(expect "True is true" (eq 1 (if t 1 0)))
(expect "False is false" (eq 1 (if nil 0 1)))
(expect "not f == t" (not nil))
(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"
(not (and t nil)))
(expect "and operator: f && t == f"
(not (and nil t)))
(expect "and operator: f && f == f"
(not (and nil nil)))
;; operator or
(expect "or operator: t || t == t"
(or t t))
(expect "or operator: t || f == t"
(or t nil))
(expect "or operator: f || t == t"
(or nil t))
(expect "or operator: f || f == f"
(not (or nil nil)))