Moving even more stuff out of the rust core

Signed-off-by: teo3300 <matteo.rogora@live.it>
This commit is contained in:
teo3300
2024-01-18 13:42:41 +09:00
parent aa32495a9d
commit d8c045a5eb
6 changed files with 92 additions and 142 deletions

View File

@ -1,51 +1,40 @@
; +
(assert (= (+) 0))
(assert (= (+ 1) 1))
(assert (= (+ 1 -4) -3))
(assert (= (+ 1 1) 2))
(assert (= (+ 1 2 3 4) 10))
; -
(assert (= (-) 0))
(assert (= (- 1) -1))
(assert (= (- 2 1) 1))
(assert (= (- 1 2) -1))
(assert (= (- 10 1 2 3) 4))
; *
(assert (= (*) 1))
(assert (= (* 2) 2))
(assert (= (* 2 3) 6))
(assert (= (* -2 3) -6))
(assert (= (* -2 -3) 6))
(assert (= (* 10 1 2 3) 60))
; /
(assert (= (/) 1))
(assert (= (/ 1) 1))
(assert (= (/ 2) 0))
(assert (= (/ 3 2) 1))
(assert (= (/ 128 2 4) 16))
(assert (= (/ 2 3) 0))
; mod
(assert (= (mod 10 4) 2))
(assert (= (mod 4 10) 4))
; >
(assert (not (>)))
(assert (> 1))
(assert (> 3 2 1))
(assert (not (> 3 1 2)))
(assert (> 3 2))
(assert (not (> 1 2)))
(assert (not (> 1 1)))
; <
(assert (not (<)))
(assert (< 1))
(assert (< 1 2 3))
(assert (not (< 1 3 2)))
(assert (< 1 3))
(assert (not (< 3 2)))
(assert (not (< 1 1)))
; >=
(assert (not (>=)))
(assert (>= 1))
(assert (>= 3 2 1))
(assert (not (>= 3 1 2)))
(assert (>= 3 1))
(assert (not (>= 1 2)))
(assert (>= 1 1))
; <=
(assert (not (<=)))
(assert (<= 1))
(assert (<= 1 2 3))
(assert (not (<= 1 3 2)))
(assert (<= 1 3))
(assert (not (<= 3 2)))
(assert (<= 1 1))

View File

@ -6,53 +6,48 @@
; 1 different
; compare with foreign type
; empty
(assert (=)) ; nothing to compare with
; nil
(assert (= nil))
(assert (= nil nil nil))
(assert (= nil nil))
(assert (not (= nil true)))
(assert (not (= nil 1)))
; bool
(assert (= true))
(assert (= true true true))
(assert (not (= true false true)))
(assert (= true true))
(assert (not (= false true)))
(assert (not (= true 1)))
; int
(assert (= 1))
(assert (= 1 1 1))
(assert (not (= 1 2 1)))
(assert (= 1 1))
(assert (not (= 1 2)))
(assert (not (= 1 nil)))
; key
(assert (= :a))
(assert (= :a :a :a))
(assert (not (= :a :b :a)))
(assert (= :a :a))
(assert (not (= :a :b)))
(assert (not (= :a "a")))
; sym
(assert (= 'a 'a))
(assert (not (= 'a 'b)))
(assert (not (= 'a "a")))
; string
(assert (= "a"))
(assert (= "a" "a" "a"))
(assert (not (= "a" "b" "a")))
(assert (= "a" "a"))
(assert (not (= "a" "b")))
(assert (not (= "a" :a)))
; add comparison for same elements with different length
; list
(assert (= (list 1 1 1)))
(assert (= (list 1 1 1) (list 1 1 1) (list 1 1 1)))
(assert (not (= (list 1 1 1) (list 1 2 1) (list 1 1 1))))
(assert (not (= (list 1) (list 1 1))))
(assert (not (= (list 1 1) (list 1))))
(assert (not (= () (list 1))))
(assert (not (= (list 1) ())))
(assert (not (= (list 1 1 1) [1 1 1])))
(assert (= '(1 1 1) '(1 1 1)))
(assert (not (= '(1 2 1) '(1 1 1))))
(assert (not (= '(1) '(1 1))))
(assert (not (= '(1 1) '(1))))
(assert (not (= () '(1))))
(assert (not (= '(1) ())))
(assert (not (= '(1 1 1) [1 1 1])))
; vector
(assert (= [1 1 1]))
(assert (= [1 1 1] [1 1 1] [1 1 1]))
(assert (not (= [1 1 1] [1 2 1] [1 1 1])))
(assert (not (= [1 1 1] (list 1 1 1))))
(assert (= [1 1 1] [1 1 1]))
(assert (not (= [1 2 1] [1 1 1])))
(assert (not (= [1 1 1] '(1 1 1))))