mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-05 18:21:40 +03:00
34 lines
624 B
Plaintext
34 lines
624 B
Plaintext
|
(use Int)
|
||
|
|
||
|
(load "Test.carp")
|
||
|
(use Test)
|
||
|
|
||
|
(defn break-test []
|
||
|
(let [x 0]
|
||
|
(do
|
||
|
(while (< x 10)
|
||
|
(if (> x 4)
|
||
|
(break)
|
||
|
(set! &x (inc x))))
|
||
|
x)))
|
||
|
|
||
|
(defn all-eq [a b]
|
||
|
(if (/= (Array.count a) (Array.count b))
|
||
|
false
|
||
|
(let [eq true]
|
||
|
(do
|
||
|
(for [i 0 (Array.count a)]
|
||
|
(if (/= @(Array.nth a i) @(Array.nth b i))
|
||
|
(set! &eq false)
|
||
|
()))
|
||
|
eq))))
|
||
|
|
||
|
(defn main []
|
||
|
(with-test test
|
||
|
(assert-equal test
|
||
|
5
|
||
|
(break-test)
|
||
|
"break works as expected"
|
||
|
)
|
||
|
(print-test-results test)))
|