mirror of
https://github.com/teo3300/rust-mal.git
synced 2026-01-12 01:05:32 +01:00
Removed MalType::Bool
mplemented instead MalType::T as opposed to Maltype::Nil
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
(assert true)
|
||||
(assert t)
|
||||
(assert (ok? 1))
|
||||
(assert-eq nil (ok? (1)))
|
||||
(assert-eq true (ok? 1))
|
||||
(assert (ok? (assert true)))
|
||||
(assert-eq t (ok? 1))
|
||||
(assert (ok? (assert t)))
|
||||
(assert (not (ok? (assert nil))))
|
||||
(assert (not (ok? (assert-fail '1))))
|
||||
(assert-fail '(1))
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
|
||||
; nil
|
||||
(assert (= nil nil))
|
||||
(assert (not (= nil true)))
|
||||
(assert (not (= nil t)))
|
||||
(assert (not (= nil 1)))
|
||||
|
||||
; bool
|
||||
(assert (= true true))
|
||||
(assert (not (= false true)))
|
||||
(assert (not (= true 1)))
|
||||
(assert (= t t))
|
||||
(assert (not (= nil t)))
|
||||
(assert (not (= t 1)))
|
||||
|
||||
; int
|
||||
(assert (= 1 1))
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
expected
|
||||
"got"
|
||||
(n-fib n)))
|
||||
(assert false))))) ; cause test panic
|
||||
(assert nil))))) ; cause test panic
|
||||
|
||||
(assert-fib 0 0)
|
||||
(assert-fib 1 1)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
; def!
|
||||
(assert (not (def! FALSE nil)))
|
||||
(assert (def! TRUE true))
|
||||
(assert (def! TRUE t))
|
||||
|
||||
(println :def)
|
||||
(def! value-0 0)
|
||||
@ -32,13 +32,13 @@
|
||||
(assert-eq (do) nil)
|
||||
|
||||
; if
|
||||
(assert (if true 1))
|
||||
(assert (not (if false 1)))
|
||||
(assert (not (if false nil)))
|
||||
(assert (if false nil 1))
|
||||
(assert (if true 1 nil))
|
||||
(assert-fail '(if true))
|
||||
(assert-fail '(if false))
|
||||
(assert (if t 1))
|
||||
(assert (not (if nil 1)))
|
||||
(assert (not (if nil nil)))
|
||||
(assert (if nil nil 1))
|
||||
(assert (if t 1 nil))
|
||||
(assert-fail '(if t))
|
||||
(assert-fail '(if nil))
|
||||
(assert-fail '(if))
|
||||
|
||||
; let*
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
; positive assert
|
||||
(assert true)
|
||||
(assert t)
|
||||
(assert ())
|
||||
(assert 1)
|
||||
|
||||
; not
|
||||
(assert (not false))
|
||||
(assert (not nil))
|
||||
(assert (not (not true)))
|
||||
(assert (not nil))
|
||||
(assert (not (not t)))
|
||||
|
||||
; or
|
||||
(assert (not (or nil nil)))
|
||||
|
||||
Reference in New Issue
Block a user