owa-rs/modules/core/tests/math.owa
2026-05-06 12:21:06 +03:00

40 lines
661 B
Text

(namespace tests.math
(test.case "math.add"
(assert.eq! (+ 1 2) 3)
(assert.eq! (+ 0 0) 0)
)
(test.case "math.sub"
(assert.eq! (- 5 3) 2)
(assert.eq! (- 1 1) 0)
)
(test.case "math.mul"
(assert.eq! (* 3 4) 12)
(assert.eq! (* 0 5) 0)
)
(test.case "math.div"
(assert.eq! (/ 10 2) 5)
)
(test.case "math.mod"
(assert.eq! (% 10 3) 1)
(assert.eq! (% 5 5) 0)
)
(test.case "math.pow"
(assert.eq! (** 2 3) 8)
(assert.eq! (** 5 2) 25)
)
(test.case "math.++"
(assert.eq! (++ 5) 6)
(assert.eq! (++ 0) 1)
)
(test.case "math.--"
(assert.eq! (-- 5) 4)
(assert.eq! (-- 0) -1)
)
)