Files
rust-mal/tests/arithmetic.mal
teo3300 c5406458de Adding collect function
- Collect function as fn:(collector, x) -> new_collector for collections
- Moving some definitions to "libs" folder
- Map and filter defined in mal
2024-06-19 15:51:20 +09:00

40 lines
583 B
Plaintext

; +
(assert (= (+ 1 -4) -3))
(assert (= (+ 1 1) 2))
; -
(assert (= (- 2 1) 1))
(assert (= (- 1 2) -1))
; *
(assert (= (* 2 3) 6))
(assert (= (* -2 3) -6))
(assert (= (* -2 -3) 6))
; /
(assert (= (/ 3 2) 1))
(assert (= (/ 2 3) 0))
(assert (= (/ -10 2) -5))
(assert (= (/ -10 -2) 5))
(assert (not (ok? (/ 12 0))))
; >
(assert (> 3 2))
(assert (not (> 1 2)))
(assert (not (> 1 1)))
; <
(assert (< 1 3))
(assert (not (< 3 2)))
(assert (not (< 1 1)))
; >=
(assert (>= 3 1))
(assert (not (>= 1 2)))
(assert (>= 1 1))
; <=
(assert (<= 1 3))
(assert (not (<= 3 2)))
(assert (<= 1 1))