mirror of
https://github.com/janet-lang/janet
synced 2024-12-26 08:20:27 +00:00
12 lines
269 B
Plaintext
12 lines
269 B
Plaintext
|
# Define assert
|
||
|
(: assert (fn [x e] (if x x (do (print e) (exit 1)))))
|
||
|
|
||
|
# Basic Math
|
||
|
(assert (= 10 (+ 1 2 3 4), "addition")
|
||
|
(assert (= -8 (- 1 2 3 4), "subtraction")
|
||
|
(assert (= 24 (* 1 2 3 4), "multiplication")
|
||
|
(assert (= 0.1 (/ 1 10), "division")
|
||
|
|
||
|
# All good
|
||
|
(exit 0)
|