~subsetpark/ec

ref: 90ec763d7df1952b79d9c13cfd13f9f5b9e9818c ec/test-support.janet -rw-r--r-- 413 bytes
90ec763d — Zach Smith Some help functions 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(import /src/calc)

(use testament)

(defn unwrap
  [obj]
  (match obj
    {:data data} (map unwrap data)
    {:value value} value))

(defn vec=
  [val obj]
  (is (== val (unwrap obj))))

(defn wrap
  [& args]
  (calc/wrap ;(map |(if (number? $)
                      (:new calc/Int $)
                      $)
                   args)))

(defn pop-and-compare
  [val s]
  (is (= val (calc/value (calc/pop s)))))