Minilisp.pm/t/bool.t

37 lines
704 B
Perl
Raw Normal View History

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)))
(expect "False is false" (eq 1 (if nil 0 1)))
2021-04-02 16:20:15 +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"
(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"
(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"
(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"
(not (or nil nil)))