diff --git a/README.md b/README.md index dda5efb..46cb72b 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Tests are organized in three layers: is the authoritative description of what Jolt promises. - **`test/integration/`** — cross-cutting and regression batteries: the Clojure conformance suite, SCI bootstrap/runtime loading, jank conformance, compile-mode - tests, and ported Clojure test batteries. + tests, the library API, and a broad systematic-coverage net. - **`test/unit/`** — white-box tests for individual components (reader, evaluator, types, persistent collections, regex, compiler). diff --git a/test/integration/clojure-atom-test.janet b/test/integration/clojure-atom-test.janet deleted file mode 100644 index 121bd41..0000000 --- a/test/integration/clojure-atom-test.janet +++ /dev/null @@ -1,154 +0,0 @@ -# Ported from clojure/test_clojure/atoms.clj + systematic atom tests -(use ../../src/jolt/api) -(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s))) - -(print "Ported Atom Tests") - -# --- atom creation --- -(print "test atom creation...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(atom? (atom 0))")) "atom?") - (assert (= false (ct-eval ctx "(atom? nil)")) "atom? nil") - (assert (= false (ct-eval ctx "(atom? 42)")) "atom? number") - (assert (= false (ct-eval ctx "(atom? \"x\")")) "atom? string") - (assert (= 42 (ct-eval ctx "(deref (atom 42))")) "deref atom") - (assert (= 99 (ct-eval ctx "(let [a (atom 99)] @a)")) "@ deref macro")) -(print " ok") - -# --- deref on non-atoms --- -(print "test deref...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(deref 1)")) "deref non-atom passes through") - (assert (= "x" (ct-eval ctx "(deref \"x\")")) "deref string passes through") - (assert (= nil (ct-eval ctx "(deref nil)")) "deref nil")) -(print " ok") - -# --- reset! --- -(print "test reset!...") -(let [ctx (init)] - (assert (= :b (ct-eval ctx "(let [a (atom :a)] (reset! a :b))")) "reset! returns new") - (assert (= 42 (ct-eval ctx "(let [a (atom 0)] (reset! a 42) @a)")) "reset! updates value") - (assert (= true (ct-eval ctx "(= [1 1] (let [a (atom 0)] [(reset! a 1) @a]))")) "reset! returns new, value changed")) -(print " ok") - -# --- swap! --- -(print "test swap!...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(let [a (atom 0)] (swap! a inc))")) "swap! inc returns new") - (assert (= 2 (ct-eval ctx "(let [a (atom 0)] (swap! a + 2))")) "swap! + 2") - (assert (= 3 (ct-eval ctx "(let [a (atom 0)] (swap! a + 1 2) @a)")) "swap! + 1 2") - (assert (= 6 (ct-eval ctx "(let [a (atom 0)] (swap! a + 1 2 3) @a)")) "swap! + 1 2 3") - (assert (= 10 (ct-eval ctx "(let [a (atom 0)] (swap! a + 1 2 3 4) @a)")) "swap! + 1 2 3 4")) -(print " ok") - -# --- swap-vals! (returns [old new]) --- -(print "test swap-vals!...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(= [0 1] (let [a (atom 0)] (swap-vals! a inc)))")) "swap-vals! inc") - (assert (= true (ct-eval ctx - "(= [1 2] (let [a (atom 1)] (swap-vals! a inc)))")) "swap-vals! inc from 1") - (assert (= 2 (ct-eval ctx - "(let [a (atom 1)] (swap-vals! a inc) @a)")) "swap-vals! updates value")) -(print " ok") - -# --- swap-vals! with extra args --- -(print "test swap-vals! arities...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(= [0 1] (let [a (atom 0)] (swap-vals! a + 1)))")) "swap-vals! + 1") - (assert (= true (ct-eval ctx - "(= [1 3] (let [a (atom 0)] (swap-vals! a + 1) (swap-vals! a + 1 1)))")) "swap-vals! + 1 1") - (assert (= true (ct-eval ctx - "(= [3 6] (let [a (atom 0)] (swap-vals! a + 1) (swap-vals! a + 1 1) (swap-vals! a + 1 1 1)))")) "swap-vals! + 1 1 1") - (assert (= true (ct-eval ctx - "(= [6 10] (let [a (atom 0)] (swap-vals! a + 1) (swap-vals! a + 1 1) (swap-vals! a + 1 1 1) (swap-vals! a + 1 1 1 1)))")) "swap-vals! + 1 1 1 1")) -(print " ok") - -# --- reset-vals! (returns [old new]) --- -(print "test reset-vals!...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(= [0 :b] (let [a (atom 0)] (reset-vals! a :b)))")) "reset-vals! returns old new") - (assert (= true (ct-eval ctx - "(= [:b 42] (let [a (atom 0)] (reset-vals! a :b) (reset-vals! a 42)))")) "reset-vals! chain") - (assert (= 42 (ct-eval ctx - "(let [a (atom 0)] (reset-vals! a :b) (reset-vals! a 42) @a)")) "reset-vals! updates value")) -(print " ok") - -# --- compare-and-set! --- -(print "test compare-and-set!...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(let [a (atom 0)] (compare-and-set! a 0 1))")) "CAS true match") - (assert (= true (ct-eval ctx - "(= [true 1] (let [a (atom 0)] [(compare-and-set! a 0 1) @a]))")) "CAS true + value changed") - (assert (= true (ct-eval ctx - "(= [false 0] (let [a (atom 0)] [(compare-and-set! a 1 2) @a]))")) "CAS false no match") - (assert (= true (ct-eval ctx - "(= [false 1] (let [a (atom 0)] (compare-and-set! a 0 1) [(compare-and-set! a 0 2) @a]))")) "CAS false after change")) -(print " ok") - -# --- validator --- -(print "test validator...") -(let [ctx (init)] - (assert (= 42 (ct-eval ctx - "(let [a (atom 0 :validator pos?)] (reset! a 42) @a)")) "validator passes") - (assert (= true (ct-eval ctx - "(= false (try (let [a (atom 0 :validator pos?)] (reset! a -1) true) (catch Exception e false)))")) "validator blocks invalid reset!") - (assert (= true (ct-eval ctx - "(= false (try (let [a (atom 0 :validator pos?)] (swap! a (fn [x] -1)) true) (catch Exception e false)))")) "validator blocks invalid swap!") - (assert (= nil (ct-eval ctx "(set-validator! (atom 0) pos?)")) "set-validator! returns nil") - (assert (= nil (ct-eval ctx "(get-validator (atom 0))")) "get-validator nil default") - (assert (= true (ct-eval ctx - "(= even? (do (def a (atom 0)) (set-validator! a even?) (get-validator a)))")) "get-validator returns set fn")) -(print " ok") - -# --- watches --- -(print "test watches...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(empty? (:watches (atom 0)))")) "atom starts with empty watches") - (assert (= true (ct-eval ctx - "(= [0 42] (let [a (atom 0) - w (atom nil)] - (add-watch a :my-key (fn [k ref old new] (reset! w [old new]))) - (swap! a + 42) - @w))")) "add-watch triggers on swap!") - (assert (= true (ct-eval ctx - "(= :unchanged (let [a (atom 0) - w (atom :unchanged)] - (add-watch a :x (fn [_ _ _ _] (reset! w :fired))) - (remove-watch a :x) - (swap! a inc) - @w))")) "remove-watch stops notification") - (assert (= true (ct-eval ctx - "(= 2 (let [a (atom 0)] - (add-watch a :foo (fn [_ _ _ _] nil)) - (add-watch a :bar (fn [_ _ _ _] nil)) - (count (:watches a))))")) "multiple watches") - (assert (= true (ct-eval ctx - "(= 0 (let [a (atom 0)] - (add-watch a :foo (fn [_ _ _ _] nil)) - (remove-watch a :foo) - (count (:watches a))))")) "remove-watch clears count") - (assert (= true (ct-eval ctx - "(= 2 (let [a (atom 0) - fired (atom [])] - (add-watch a :w1 (fn [_ _ o n] (swap! fired conj [:w1 o n]))) - (add-watch a :w2 (fn [_ _ o n] (swap! fired conj [:w2 o n]))) - (reset! a 99) - (count @fired)))")) "multiple watches both fire")) -(print " ok") - -# --- metadata on atoms --- -(print "test atom metadata...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(meta (atom 0))")) "atom meta nil by default") - (assert (= true (ct-eval ctx - "(= {:foo \"bar\"} (meta (atom 0 :meta {:foo \"bar\"})))")) "atom with :meta") - (assert (= true (ct-eval ctx - "(= {:validated true} (meta (atom 0 :validator pos? :meta {:validated true})))")) "atom with validator and meta")) -(print " ok") - -(print "\nAll Ported Atom tests passed!") diff --git a/test/integration/clojure-control-test.janet b/test/integration/clojure-control-test.janet deleted file mode 100644 index 0e557b8..0000000 --- a/test/integration/clojure-control-test.janet +++ /dev/null @@ -1,151 +0,0 @@ -# Ported from clojure/test_clojure/control.clj -(use ../../src/jolt/api) -(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s))) - -(print "Ported Control Tests") - -# --- test-do --- -(print "test-do...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(do)")) "do empty -> nil") - (assert (= 1 (ct-eval ctx "(do 1)")) "do returns last") - (assert (= 2 (ct-eval ctx "(do 1 2)")) "do returns last") - (assert (= 5 (ct-eval ctx "(do 1 2 3 4 5)")) "do returns last")) -(print " ok") - -# --- test-loop --- -(print "test-loop...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(loop [] 1)")) "loop body") - (assert (= 3 (ct-eval ctx "(loop [a 1] (if (< a 3) (recur (inc a)) a))")) "loop recur") - (assert (= true (ct-eval ctx - "(= [6 4 2] (loop [a () b [1 2 3]] - (if (seq b) - (recur (conj a (* 2 (first b))) (next b)) - a)))")) "loop accum list") - (assert (= true (ct-eval ctx - "(= [2 4 6] (loop [a [] b [1 2 3]] - (if (seq b) - (recur (conj a (* 2 (first b))) (next b)) - a)))")) "loop accum vector")) -(print " ok") - -# --- test-when --- -(print "test-when...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(when true 1)")) "when true") - (assert (= nil (ct-eval ctx "(when true)")) "when true no body") - (assert (= nil (ct-eval ctx "(when false)")) "when false") - (assert (= nil (ct-eval ctx "(when false 1)")) "when false with body")) -(print " ok") - -# --- test-when-not --- -(print "test-when-not...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(when-not false 1)")) "when-not false") - (assert (= nil (ct-eval ctx "(when-not true)")) "when-not true no body") - (assert (= nil (ct-eval ctx "(when-not false)")) "when-not false no body") - (assert (= nil (ct-eval ctx "(when-not true 1)")) "when-not true with body")) -(print " ok") - -# --- test-if-not --- -(print "test-if-not...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(if-not false 1)")) "if-not false") - (assert (= 1 (ct-eval ctx "(if-not false 1 2)")) "if-not false with else") - (assert (= nil (ct-eval ctx "(if-not true 1)")) "if-not true") - (assert (= 2 (ct-eval ctx "(if-not true 1 2)")) "if-not true with else")) -(print " ok") - -# --- test-when-let --- -(print "test-when-let...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(when-let [a 1] a)")) "when-let simple") - (assert (= 2 (ct-eval ctx "(when-let [[a b] '(1 2)] b)")) "when-let destructure") - (assert (= nil (ct-eval ctx "(when-let [a false] 1)")) "when-let false")) -(print " ok") - -# --- test-if-let --- -(print "test-if-let...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(if-let [a 1] a)")) "if-let simple") - (assert (= 2 (ct-eval ctx "(if-let [[a b] '(1 2)] b)")) "if-let destructure") - (assert (= nil (ct-eval ctx "(if-let [a false] 1)")) "if-let false") - (assert (= 1 (ct-eval ctx "(if-let [a false] a 1)")) "if-let false with else")) -(print " ok") - -# --- test-if-some --- -(print "test-if-some...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(if-some [a 1] a)")) "if-some simple") - (assert (= false (ct-eval ctx "(if-some [a false] a)")) "if-some false is some") - (assert (= nil (ct-eval ctx "(if-some [a nil] 1)")) "if-some nil") - (assert (= 3 (ct-eval ctx "(if-some [[a b] [1 2]] (+ a b))")) "if-some destructure")) -(print " ok") - -# --- test-when-some --- -(print "test-when-some...") -(let [ctx (init)] - (assert (= 1 (ct-eval ctx "(when-some [a 1] a)")) "when-some simple") - (assert (= 2 (ct-eval ctx "(when-some [[a b] [1 2]] b)")) "when-some destructure") - (assert (= false (ct-eval ctx "(when-some [a false] a)")) "when-some false is some") - (assert (= nil (ct-eval ctx "(when-some [a nil] 1)")) "when-some nil")) -(print " ok") - -# --- test-cond --- -(print "test-cond...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(cond)")) "cond empty -> nil") - (assert (= nil (ct-eval ctx "(cond nil true)")) "cond nil -> nil") - (assert (= nil (ct-eval ctx "(cond false true)")) "cond false -> nil") - (assert (= 1 (ct-eval ctx "(cond true 1)")) "cond true -> 1") - (assert (= 3 (ct-eval ctx "(cond nil 1 false 2 true 3 true 4)")) "cond third branch") - (assert (= :b (ct-eval ctx "(cond false :a true :b)")) "cond skips false") - (assert (= :a (ct-eval ctx "(cond true :a true :b)")) "cond takes first true")) -(print " ok") - -# --- test-condp --- -(print "test-condp...") -(let [ctx (init)] - (assert (= :pass (ct-eval ctx "(condp = 1 1 :pass 2 :fail)")) "condp match first") - (assert (= :pass (ct-eval ctx "(condp = 1 2 :fail 1 :pass)")) "condp match second") - (assert (= :pass (ct-eval ctx "(condp = 1 2 :fail :pass)")) "condp default")) -(print " ok") - -# --- test-dotimes --- -(print "test-dotimes...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(dotimes [n 1] n)")) "dotimes returns nil") - (assert (= 3 (ct-eval ctx - "(let [a (atom 0)] - (dotimes [n 3] (swap! a inc)) - @a)")) "dotimes 3 iterations") - (assert (= [0 1 2] (ct-eval ctx - "(let [a (atom [])] - (dotimes [n 3] (swap! a conj n)) - @a)")) "dotimes with index")) -(print " ok") - -# --- test-while --- -(print "test-while...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(while nil 1)")) "while nil returns nil") - (assert (= true (ct-eval ctx - "(= [0 nil] - (let [a (atom 3) - w (while (pos? @a) (swap! a dec))] - [@a w]))")) "while dec to 0")) -(print " ok") - -# --- test-case --- -(print "test-case...") -(let [ctx (init)] - (assert (= :number (ct-eval ctx "(case 1 1 :number :default)")) "case match 1") - (assert (= :string (ct-eval ctx "(case \"foo\" \"foo\" :string :default)")) "case match string") - (assert (= :kw (ct-eval ctx "(case :zap :zap :kw :default)")) "case match keyword") - (assert (= :symbol (ct-eval ctx "(case 'pow pow :symbol :default)")) "case match symbol") - (assert (= :default (ct-eval ctx "(case 99 1 :number :default)")) "case default") - (assert (= :matched (ct-eval ctx "(case 2 (2 3 4) :matched :default)")) "case one-of-many")) -(print " ok") - -(print "\nAll Ported Control tests passed!") diff --git a/test/integration/clojure-for-test.janet b/test/integration/clojure-for-test.janet deleted file mode 100644 index f313d41..0000000 --- a/test/integration/clojure-for-test.janet +++ /dev/null @@ -1,35 +0,0 @@ -# Ported from clojure/test_clojure/for.clj -(use ../../src/jolt/api) -(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s))) - -(print "Ported For Tests") - -# --- When --- -(print "test-for :when...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(= (for [x (range 10) :when (odd? x)] x) - (quote (1 3 5 7 9)))")) "for :when odd?") - (assert (= true (ct-eval ctx - "(= (for [x (range 4) y (range 4) :when (odd? y)] [x y]) - (quote ([0 1] [0 3] [1 1] [1 3] [2 1] [2 3] [3 1] [3 3])))")) "for nested :when")) -(print " ok") - -# --- Let --- -(print "test-for :let...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(= (for [x (range 3) y (range 3) :let [z (+ x y)] :when (odd? z)] [x y z]) - (quote ([0 1 1] [1 0 1] [1 2 3] [2 1 3])))")) "for :let :when")) -(print " ok") - -# --- Nesting --- -(print "test-for nesting...") -(let [ctx (init)] - (assert (= true (ct-eval ctx - "(= (for [x (quote (a b)) y (interpose x (quote (1 2))) z (list x y)] [x y z]) - (quote ([a 1 a] [a 1 1] [a a a] [a a a] [a 2 a] [a 2 2] - [b 1 b] [b 1 1] [b b b] [b b b] [b 2 b] [b 2 2])))")) "for nested interpose")) -(print " ok") - -(print "\nAll Ported For tests passed!") diff --git a/test/integration/clojure-logic-test.janet b/test/integration/clojure-logic-test.janet deleted file mode 100644 index 916cd77..0000000 --- a/test/integration/clojure-logic-test.janet +++ /dev/null @@ -1,127 +0,0 @@ -# Ported from clojure/test_clojure/logic.clj -(use ../../src/jolt/api) -(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s))) - -(print "Ported Logic Tests (from clojure/test-clojure/logic.clj)") - -# --- test-if --- -(print "test-if: true/false/nil...") -(let [ctx (init)] - (assert (= :t (ct-eval ctx "(if true :t)")) "if true") - (assert (= :t (ct-eval ctx "(if true :t :f)")) "if true with else") - (assert (= nil (ct-eval ctx "(if false :t)")) "if false no else") - (assert (= :f (ct-eval ctx "(if false :t :f)")) "if false with else") - (assert (= nil (ct-eval ctx "(if nil :t)")) "if nil no else") - (assert (= :f (ct-eval ctx "(if nil :t :f)")) "if nil with else")) -(print " ok") - -(print "test-if: zero/empty is true...") -(let [ctx (init)] - (assert (= :t (ct-eval ctx "(if 0 :t :f)")) "0 is true") - (assert (= :t (ct-eval ctx "(if 0.0 :t :f)")) "0.0 is true") - (assert (= :t (ct-eval ctx "(if \"\" :t :f)")) "empty string is true") - (assert (= :t (ct-eval ctx "(if () :t :f)")) "empty list is true") - (assert (= :t (ct-eval ctx "(if [] :t :f)")) "empty vector is true") - (assert (= :t (ct-eval ctx "(if {} :t :f)")) "empty map is true") - (assert (= :t (ct-eval ctx "(if #{} :t :f)")) "empty set is true")) -(print " ok") - -(print "test-if: anything except nil/false is true...") -(let [ctx (init)] - (assert (= :t (ct-eval ctx "(if 42 :t :f)")) "42 is true") - (assert (= :t (ct-eval ctx "(if 1.2 :t :f)")) "1.2 is true") - (assert (= :t (ct-eval ctx "(if \"abc\" :t :f)")) "string is true") - (assert (= :t (ct-eval ctx "(if 'abc :t :f)")) "symbol is true") - (assert (= :t (ct-eval ctx "(if :kw :t :f)")) "keyword is true") - (assert (= :t (ct-eval ctx "(if '(1 2) :t :f)")) "list is true") - (assert (= :t (ct-eval ctx "(if [1 2] :t :f)")) "vector is true") - (assert (= :t (ct-eval ctx "(if {:a 1 :b 2} :t :f)")) "map is true") - (assert (= :t (ct-eval ctx "(if #{1 2} :t :f)")) "set is true")) -(print " ok") - -# --- test-nil-punning --- -(print "test-nil-punning...") -(let [ctx (init)] - (assert (= :yes (ct-eval ctx "(if (first []) :no :yes)")) "first [] nil") - (assert (= :yes (ct-eval ctx "(if (next [1]) :no :yes)")) "next [1] nil") - (assert (= :no (ct-eval ctx "(if (rest [1]) :no :yes)")) "rest [1] non-nil") - (assert (= :yes (ct-eval ctx "(if (seq nil) :no :yes)")) "seq nil") - (assert (= :yes (ct-eval ctx "(if (seq []) :no :yes)")) "seq [] nil") - (assert (= :no (ct-eval ctx "(if (lazy-seq nil) :no :yes)")) "lazy-seq nil non-nil") - (assert (= :no (ct-eval ctx "(if (lazy-seq []) :no :yes)")) "lazy-seq [] non-nil") - (assert (= :no (ct-eval ctx "(if (filter (fn [x] (> x 10)) [1 2 3]) :no :yes)")) "filter non-match non-nil") - (assert (= :no (ct-eval ctx "(if (map identity []) :no :yes)")) "map empty non-nil") - (assert (= :no (ct-eval ctx "(if (apply concat []) :no :yes)")) "apply concat [] non-nil") - (assert (= :no (ct-eval ctx "(if (concat) :no :yes)")) "concat empty non-nil") - (assert (= :no (ct-eval ctx "(if (concat []) :no :yes)")) "concat [] non-nil") - (assert (= :no (ct-eval ctx "(if (reverse nil) :no :yes)")) "reverse nil non-nil") - (assert (= :no (ct-eval ctx "(if (reverse []) :no :yes)")) "reverse [] non-nil") - (assert (= :no (ct-eval ctx "(if (sort nil) :no :yes)")) "sort nil non-nil") - (assert (= :no (ct-eval ctx "(if (sort []) :no :yes)")) "sort [] non-nil")) -(print " ok") - -# --- test-and --- -(print "test-and...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(and)")) "and empty") - (assert (= true (ct-eval ctx "(and true)")) "and true") - (assert (= nil (ct-eval ctx "(and nil)")) "and nil") - (assert (= false (ct-eval ctx "(and false)")) "and false") - (assert (= nil (ct-eval ctx "(and true nil)")) "and true nil") - (assert (= false (ct-eval ctx "(and true false)")) "and true false") - (assert (= "abc" (ct-eval ctx "(and 1 true :kw 'abc \"abc\")")) "and chain last") - (assert (= nil (ct-eval ctx "(and 1 true :kw nil 'abc \"abc\")")) "and chain nil") - (assert (= false (ct-eval ctx "(and 1 true :kw 'abc \"abc\" false)")) "and chain false")) -(print " ok") - -# --- test-or --- -(print "test-or...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(or)")) "or empty") - (assert (= true (ct-eval ctx "(or true)")) "or true") - (assert (= nil (ct-eval ctx "(or nil)")) "or nil") - (assert (= false (ct-eval ctx "(or false)")) "or false") - (assert (= true (ct-eval ctx "(or nil false true)")) "or nil false true") - (assert (= 1 (ct-eval ctx "(or nil false 1 2)")) "or picks first truthy") - (assert (= "abc" (ct-eval ctx "(or nil false \"abc\" :kw)")) "or picks string") - (assert (= nil (ct-eval ctx "(or false nil)")) "or false nil -> nil") - (assert (= false (ct-eval ctx "(or nil false)")) "or nil false -> false") - (assert (= false (ct-eval ctx "(or nil nil nil false)")) "or chain to false") - (assert (= true (ct-eval ctx "(or nil true false)")) "or nil true false")) -(print " ok") - -# --- test-not --- -(print "test-not...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(not nil)")) "not nil") - (assert (= true (ct-eval ctx "(not false)")) "not false") - (assert (= false (ct-eval ctx "(not true)")) "not true") - (assert (= false (ct-eval ctx "(not 0)")) "not 0") - (assert (= false (ct-eval ctx "(not 0.0)")) "not 0.0") - (assert (= false (ct-eval ctx "(not 42)")) "not 42") - (assert (= false (ct-eval ctx "(not 1.2)")) "not 1.2") - (assert (= false (ct-eval ctx "(not \"\")")) "not empty string") - (assert (= false (ct-eval ctx "(not \"abc\")")) "not string") - (assert (= false (ct-eval ctx "(not 'abc)")) "not symbol") - (assert (= false (ct-eval ctx "(not :kw)")) "not keyword") - (assert (= false (ct-eval ctx "(not ())")) "not empty list") - (assert (= false (ct-eval ctx "(not '(1 2))")) "not list") - (assert (= false (ct-eval ctx "(not []))")) "not empty vector") - (assert (= false (ct-eval ctx "(not [1 2])")) "not vector") - (assert (= false (ct-eval ctx "(not {})")) "not empty map") - (assert (= false (ct-eval ctx "(not {:a 1 :b 2})")) "not map") - (assert (= false (ct-eval ctx "(not #{})")) "not empty set") - (assert (= false (ct-eval ctx "(not #{1 2})")) "not set")) -(print " ok") - -# --- test-some? --- -(print "test-some?...") -(let [ctx (init)] - (assert (= false (ct-eval ctx "(some? nil)")) "some? nil") - (assert (= true (ct-eval ctx "(some? false)")) "some? false") - (assert (= true (ct-eval ctx "(some? 0)")) "some? 0") - (assert (= true (ct-eval ctx "(some? \"abc\")")) "some? string") - (assert (= true (ct-eval ctx "(some? [])")) "some? empty vec")) -(print " ok") - -(print "\nAll Ported Logic tests passed!") diff --git a/test/integration/clojure-macros-test.janet b/test/integration/clojure-macros-test.janet deleted file mode 100644 index a5e4143..0000000 --- a/test/integration/clojure-macros-test.janet +++ /dev/null @@ -1,63 +0,0 @@ -# Ported from clojure/test_clojure/macros.clj -(use ../../src/jolt/api) -(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s))) - -(print "Ported Macros Tests") - -# --- -> and ->> threading --- -(print "test -> and ->>...") -(let [ctx (init)] - (ct-eval ctx "(defmacro c [arg] (if (= 'b (first arg)) :foo :bar))") - (ct-eval ctx "(def a 2)") - (ct-eval ctx "(def b identity)") - (assert (= :foo (ct-eval ctx "(-> a b c)")) "-> threading") - (assert (= :foo (ct-eval ctx "(->> a b c)")) "->> threading")) -(print " ok") - -# --- some-> --- -(print "test some->...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(some-> nil)")) "some-> nil") - (assert (= 0 (ct-eval ctx "(some-> 0)")) "some-> 0") - (assert (= -1 (ct-eval ctx "(some-> 1 (- 2))")) "some-> with form") - (ct-eval ctx "(defn const-nil [_] nil)") - (assert (= nil (ct-eval ctx "(some-> 1 const-nil (- 2))")) "some-> stop at nil")) -(print " ok") - -# --- some->> --- -(print "test some->>...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(some->> nil)")) "some->> nil") - (assert (= 0 (ct-eval ctx "(some->> 0)")) "some->> 0") - (assert (= 1 (ct-eval ctx "(some->> 1 (- 2))")) "some->> with form") - (ct-eval ctx "(defn const-nil2 [_] nil)") - (assert (= nil (ct-eval ctx "(some->> 1 const-nil2 (- 2))")) "some->> stop at nil")) -(print " ok") - -# --- cond-> --- -(print "test cond->...") -(let [ctx (init)] - (assert (= 0 (ct-eval ctx "(cond-> 0)")) "cond-> single") - (assert (= -1 (ct-eval ctx "(cond-> 0 true inc true (- 2))")) "cond-> with tests") - (assert (= 0 (ct-eval ctx "(cond-> 0 false inc)")) "cond-> false test") - (assert (= -1 (ct-eval ctx "(cond-> 1 true (- 2) false inc)")) "cond-> mix")) -(print " ok") - -# --- cond->> --- -(print "test cond->>...") -(let [ctx (init)] - (assert (= 0 (ct-eval ctx "(cond->> 0)")) "cond->> single") - (assert (= 1 (ct-eval ctx "(cond->> 0 true inc true (- 2))")) "cond->> with tests") - (assert (= 0 (ct-eval ctx "(cond->> 0 false inc)")) "cond->> false test") - (assert (= 1 (ct-eval ctx "(cond->> 1 true (- 2) false inc)")) "cond->> mix")) -(print " ok") - -# --- as-> --- -(print "test as->...") -(let [ctx (init)] - (assert (= 0 (ct-eval ctx "(as-> 0 x)")) "as-> single") - (assert (= 1 (ct-eval ctx "(as-> 0 x (inc x))")) "as-> one form") - (assert (= 2 (ct-eval ctx "(as-> [0 1] x (map inc x) (reverse x) (first x))")) "as-> chain")) -(print " ok") - -(print "\nAll Ported Macros tests passed!") diff --git a/test/integration/core-test.janet b/test/integration/core-test.janet deleted file mode 100644 index 989815b..0000000 --- a/test/integration/core-test.janet +++ /dev/null @@ -1,122 +0,0 @@ -(use ../../src/jolt/types) -(use ../../src/jolt/pv) -(use ../../src/jolt/plist) -(use ../../src/jolt/reader) -(use ../../src/jolt/evaluator) -(use ../../src/jolt/core) - -# Normalize jolt collection results to Janet tuples so Janet-level deep=/= can -# compare against tuple literals regardless of the (pvec/plist) representation. -(defn norm [x] - (cond - (pvec? x) (tuple ;(map norm (pv->array x))) - (plist? x) (tuple ;(map norm (pl->array x))) - (tuple? x) (tuple ;(map norm x)) - (array? x) (tuple ;(map norm x)) - x)) - -# Helper: create a fresh bootstrapped context -(defn make-boot-ctx [] - (let [ctx (make-ctx)] - (init-core! ctx) - ctx)) - -# Helper: parse + eval -(defn eval-str [ctx s] - (let [form (parse-string s)] - (norm (eval-form ctx @{} form)))) - -(print "1: predicates...") -(let [ctx (make-boot-ctx)] - (assert (= true (eval-str ctx "(nil? nil)")) "nil?") - (assert (= false (eval-str ctx "(nil? 1)")) "nil? false") - (assert (= true (eval-str ctx "(string? \"hello\")")) "string?") - (assert (= true (eval-str ctx "(number? 42)")) "number?") - (assert (= true (eval-str ctx "(fn? inc)")) "fn?") - (assert (= true (eval-str ctx "(keyword? :foo)")) "keyword?") - (assert (= false (eval-str ctx "(keyword? 1)")) "keyword? false") - (assert (= true (eval-str ctx "(zero? 0)")) "zero?") - (assert (= true (eval-str ctx "(pos? 1)")) "pos?") - (assert (= true (eval-str ctx "(neg? -1)")) "neg?") - (assert (= true (eval-str ctx "(even? 2)")) "even?") - (assert (= true (eval-str ctx "(odd? 1)")) "odd?") - (assert (= true (eval-str ctx "(empty? [])")) "empty? vector") - (assert (= false (eval-str ctx "(empty? [1])")) "empty? non-empty")) -(print " passed") - -(print "2: math...") -(let [ctx (make-boot-ctx)] - (assert (= 0 (eval-str ctx "(+)")) "+ 0 args") - (assert (= 5 (eval-str ctx "(+ 2 3)")) "+ 2 args") - (assert (= 10 (eval-str ctx "(+ 1 2 3 4)")) "+ varargs") - (assert (= -5 (eval-str ctx "(- 5)")) "- unary") - (assert (= 2 (eval-str ctx "(- 5 3)")) "- binary") - (assert (= 6 (eval-str ctx "(* 2 3)")) "*") - (assert (= 1 (eval-str ctx "(*)")) "* 0 args") - (assert (= 42 (eval-str ctx "(inc 41)")) "inc") - (assert (= 40 (eval-str ctx "(dec 41)")) "dec") - (assert (= 4 (eval-str ctx "(max 1 4 2)")) "max")) -(print " passed") - -(print "3: comparison...") -(let [ctx (make-boot-ctx)] - (assert (= true (eval-str ctx "(= 1 1)")) "= same") - (assert (= false (eval-str ctx "(= 1 2)")) "= diff") - (assert (= true (eval-str ctx "(= 1 1 1)")) "= multi same") - (assert (= false (eval-str ctx "(= 1 2 1)")) "= multi diff") - (assert (= true (eval-str ctx "(not= 1 2)")) "not=")) -(print " passed") - -(print "4: collections...") -(let [ctx (make-boot-ctx)] - (assert (= 3 (eval-str ctx "(count [1 2 3])")) "count vector") - (assert (= 1 (eval-str ctx "(first [1 2 3])")) "first") - (assert (deep= [2 3] (eval-str ctx "(rest [1 2 3])")) "rest") - (assert (= nil (eval-str ctx "(next [1])")) "next singleton") - (assert (deep= [1 2 3] (eval-str ctx "(conj [1 2] 3)")) "conj vector") - (assert (= 1 (eval-str ctx "(get {:a 1} :a)")) "get map") - (assert (= 2 (eval-str ctx "(get [1 2 3] 1)")) "get vector") - (assert (= :default (eval-str ctx "(get {:a 1} :b :default)")) "get default") - (assert (deep= {:a 1 :c 3} (eval-str ctx "(assoc {:a 1} :c 3)")) "assoc") - (assert (deep= {:a 1} (eval-str ctx "(dissoc {:a 1 :b 2} :b)")) "dissoc")) -(print " passed") - -(print "5: seq ops...") -(let [ctx (make-boot-ctx)] - (assert (deep= [2 3 4] (eval-str ctx "(map inc [1 2 3])")) "map") - (assert (deep= [2 4] (eval-str ctx "(filter even? [1 2 3 4])")) "filter") - (assert (= 6 (eval-str ctx "(reduce + [1 2 3])")) "reduce") - (assert (= 10 (eval-str ctx "(reduce + 4 [1 2 3])")) "reduce with val") - (assert (deep= [1 2] (eval-str ctx "(take 2 [1 2 3 4])")) "take") - (assert (deep= [3 4] (eval-str ctx "(drop 2 [1 2 3 4])")) "drop") - (assert (deep= [1 2] (eval-str ctx "(take-while (fn* [x] (<= x 2)) [1 2 3 4])")) "take-while")) -(print " passed") - -(print "6: range...") -(let [ctx (make-boot-ctx)] - (assert (deep= [0 1 2 3 4] (eval-str ctx "(range 5)")) "range end") - (assert (deep= [2 3 4] (eval-str ctx "(range 2 5)")) "range start end")) -(print " passed") - -(print "7: higher-order...") -(let [ctx (make-boot-ctx)] - (assert (= 42 (eval-str ctx "(identity 42)")) "identity") - (assert (= 42 (eval-str ctx "(let* [f (constantly 42)] (f))")) "constantly") - (assert (= 3 (eval-str ctx "(let* [f (comp inc inc)] (f 1))")) "comp") - (assert (deep= [2 0] (eval-str ctx "(let* [f (juxt inc dec)] (f 1))")) "juxt")) -(print " passed") - -(print "8: str...") -(let [ctx (make-boot-ctx)] - (assert (= "hello" (eval-str ctx "(str \"hello\")")) "str") - (assert (= "hello42" (eval-str ctx "(str \"hello\" 42)")) "str concat")) -(print " passed") - -(print "9: atom...") -(let [ctx (make-boot-ctx)] - (assert (= 1 (eval-str ctx "(let* [a (atom 1)] (deref a))")) "atom + deref") - (assert (= 42 (eval-str ctx "(let* [a (atom 1)] (reset! a 42) (deref a))")) "reset!") - (assert (= 2 (eval-str ctx "(let* [a (atom 1)] (swap! a inc) (deref a))")) "swap!")) -(print " passed") - -(print "\nAll core tests passed!") diff --git a/test/integration/logic-test.janet b/test/integration/logic-test.janet deleted file mode 100644 index 669b239..0000000 --- a/test/integration/logic-test.janet +++ /dev/null @@ -1,100 +0,0 @@ -(use ../../src/jolt/api) -(defn ct-eval [ctx s] (normalize-pvecs (eval-string ctx s))) -(print "Ported Logic Tests (from clojure/test-clojure/logic.clj)") - -(print "1: test-if true/false/nil...") -(let [ctx (init)] - (assert (= :t (ct-eval ctx "(if true :t)")) "if true") - (assert (= :t (ct-eval ctx "(if true :t :f)")) "if true with else") - (assert (= nil (ct-eval ctx "(if false :t)")) "if false no else") - (assert (= :f (ct-eval ctx "(if false :t :f)")) "if false with else") - (assert (= nil (ct-eval ctx "(if nil :t)")) "if nil no else") - (assert (= :f (ct-eval ctx "(if nil :t :f)")) "if nil with else")) -(print " ok") - -(print "2: test-if zero/empty is true...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(= :t (if 0 :t :f))")) "0 is true") - (assert (= true (ct-eval ctx "(= :t (if 0.0 :t :f))")) "0.0 is true") - (assert (= true (ct-eval ctx "(= :t (if \"\" :t :f))")) "empty string is true") - (assert (= true (ct-eval ctx "(= :t (if () :t :f))")) "empty list is true") - (assert (= true (ct-eval ctx "(= :t (if [] :t :f))")) "empty vector is true") - (assert (= true (ct-eval ctx "(= :t (if {} :t :f))")) "empty map is true") - (assert (= true (ct-eval ctx "(= :t (if #{} :t :f))")) "empty set is true")) -(print " ok") - -(print "3: test-if anything except nil/false is true...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(= :t (if 42 :t :f))")) "42 is true") - (assert (= true (ct-eval ctx "(= :t (if 1.5 :t :f))")) "float is true") - (assert (= true (ct-eval ctx "(= :t (if \"abc\" :t :f))")) "string is true") - (assert (= true (ct-eval ctx "(= :t (if 'abc :t :f))")) "symbol is true") - (assert (= true (ct-eval ctx "(= :t (if :kw :t :f))")) "keyword is true") - (assert (= true (ct-eval ctx "(= :t (if '(1 2) :t :f))")) "list is true") - (assert (= true (ct-eval ctx "(= :t (if [1 2] :t :f))")) "vector is true") - (assert (= true (ct-eval ctx "(= :t (if {:a 1 :b 2} :t :f))")) "map is true") - (assert (= true (ct-eval ctx "(= :t (if #{1 2} :t :f))")) "set is true")) -(print " ok") - -(print "4: test-nil-punning...") -(let [ctx (init)] - (assert (= :yes (ct-eval ctx "(if (first []) :no :yes)")) "first [] nil") - (assert (= :yes (ct-eval ctx "(if (next [1]) :no :yes)")) "next [1] nil") - (assert (= :no (ct-eval ctx "(if (rest [1]) :no :yes)")) "rest [1] non-nil") - (assert (= :yes (ct-eval ctx "(if (seq nil) :no :yes)")) "seq nil") - (assert (= :yes (ct-eval ctx "(if (seq []) :no :yes)")) "seq [] nil") - (assert (= :no (ct-eval ctx "(if (lazy-seq nil) :no :yes)")) "lazy-seq nil non-nil") - (assert (= :no (ct-eval ctx "(if (lazy-seq []) :no :yes)")) "lazy-seq [] non-nil")) -(print " ok") - -(print "5: test-and...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(and)")) "and empty") - (assert (= true (ct-eval ctx "(and true)")) "and true") - (assert (= nil (ct-eval ctx "(and nil)")) "and nil") - (assert (= false (ct-eval ctx "(and false)")) "and false") - (assert (ct-eval ctx "(= \"abc\" (and 1 true :kw 'abc \"abc\"))") "and chain last") - (assert (= nil (ct-eval ctx "(and 1 true nil 'abc \"abc\")")) "and chain nil") - (assert (= false (ct-eval ctx "(and 1 true 'abc \"abc\" false)")) "and chain false")) -(print " ok") - -(print "6: test-or...") -(let [ctx (init)] - (assert (= nil (ct-eval ctx "(or)")) "or empty") - (assert (= true (ct-eval ctx "(or true)")) "or true") - (assert (= nil (ct-eval ctx "(or nil)")) "or nil") - (assert (= false (ct-eval ctx "(or false)")) "or false") - (assert (= true (ct-eval ctx "(or nil false true)")) "or nil false true") - (assert (= 1 (ct-eval ctx "(or nil false 1 2)")) "or picks first truthy") - (assert (ct-eval ctx "(= \"abc\" (or nil false \"abc\" :kw))") "or picks string") - (assert (= nil (ct-eval ctx "(or false nil)")) "or false nil -> nil") - (assert (= false (ct-eval ctx "(or nil false)")) "or nil false -> false") - (assert (= false (ct-eval ctx "(or nil nil nil false)")) "or chain to false") - (assert (= true (ct-eval ctx "(or nil true false)")) "or nil true false")) -(print " ok") - -(print "7: test-not...") -(let [ctx (init)] - (assert (= true (ct-eval ctx "(not nil)")) "not nil") - (assert (= true (ct-eval ctx "(not false)")) "not false") - (assert (= false (ct-eval ctx "(not true)")) "not true") - (assert (= false (ct-eval ctx "(not 0)")) "not 0") - (assert (= false (ct-eval ctx "(not 42)")) "not 42") - (assert (= false (ct-eval ctx "(not \"\")")) "not empty string") - (assert (= false (ct-eval ctx "(not \"abc\")")) "not string") - (assert (= false (ct-eval ctx "(not ())")) "not empty list") - (assert (= false (ct-eval ctx "(not [])")) "not empty vector") - (assert (= false (ct-eval ctx "(not {})")) "not empty map") - (assert (= false (ct-eval ctx "(not #{})")) "not empty set")) -(print " ok") - -(print "8: test-some?...") -(let [ctx (init)] - (assert (= false (ct-eval ctx "(some? nil)")) "some? nil") - (assert (= true (ct-eval ctx "(some? false)")) "some? false") - (assert (= true (ct-eval ctx "(some? 0)")) "some? 0") - (assert (= true (ct-eval ctx "(some? \"abc\")")) "some? string") - (assert (= true (ct-eval ctx "(some? [])")) "some? empty vec")) -(print " ok") - -(print "\nAll Ported Logic tests passed!") diff --git a/test/spec/exceptions-spec.janet b/test/spec/exceptions-spec.janet index 4b0709f..7df5e47 100644 --- a/test/spec/exceptions-spec.janet +++ b/test/spec/exceptions-spec.janet @@ -17,6 +17,12 @@ ["catch value of body" "5" "(try (+ 2 3) (catch :default e 0))"]) +(defspec "exceptions / assert" + ["assert true -> ok" ":ok" "(do (assert true) :ok)"] + ["assert expr -> ok" ":ok" "(do (assert (= 1 1)) :ok)"] + ["assert false throws" :throws "(assert false)"] + ["assert nil throws" :throws "(assert nil)"]) + (defspec "exceptions / ex-info" ["ex-message" "\"oops\"" "(ex-message (ex-info \"oops\" {}))"] ["ex-data" "{:k 1}" "(ex-data (ex-info \"oops\" {:k 1}))"] diff --git a/test/spec/state-spec.janet b/test/spec/state-spec.janet index 514d9a4..b959eb2 100644 --- a/test/spec/state-spec.janet +++ b/test/spec/state-spec.janet @@ -21,7 +21,8 @@ ["add-watch fires" "1" "(let [a (atom 0) seen (atom 0)] (add-watch a :k (fn [k r o n] (reset! seen 1))) (reset! a 5) @seen)"] ["remove-watch" "0" "(let [a (atom 0) seen (atom 0)] (add-watch a :k (fn [k r o n] (swap! seen inc))) (remove-watch a :k) (reset! a 5) @seen)"] ["set-validator! ok" "5" "(let [a (atom 0)] (set-validator! a number?) (reset! a 5) @a)"] - ["set-validator! rejects" :throws "(let [a (atom 0)] (set-validator! a pos?) (reset! a -1))"]) + ["set-validator! rejects" :throws "(let [a (atom 0)] (set-validator! a pos?) (reset! a -1))"] + ["get-validator" "true" "(let [a (atom 0)] (set-validator! a number?) (fn? (get-validator a)))"]) (defspec "state / volatiles & delays" ["volatile! deref" "0" "(let [v (volatile! 0)] @v)"] diff --git a/test/spec/truthiness-spec.janet b/test/spec/truthiness-spec.janet new file mode 100644 index 0000000..a119e7a --- /dev/null +++ b/test/spec/truthiness-spec.janet @@ -0,0 +1,61 @@ +# Specification: truthiness & boolean logic. +# The core Clojure rule: ONLY nil and false are logically false; every other +# value — including 0, 0.0, "", and empty collections — is logically true. +(use ../support/harness) + +(defspec "truthiness / if (only nil & false are falsy)" + ["nil is falsy" ":f" "(if nil :t :f)"] + ["false is falsy" ":f" "(if false :t :f)"] + ["zero is truthy" ":t" "(if 0 :t :f)"] + ["zero float truthy" ":t" "(if 0.0 :t :f)"] + ["empty string truthy" ":t" "(if \"\" :t :f)"] + ["empty list truthy" ":t" "(if (list) :t :f)"] + ["empty vector truthy" ":t" "(if [] :t :f)"] + ["empty map truthy" ":t" "(if {} :t :f)"] + ["empty set truthy" ":t" "(if #{} :t :f)"] + ["number truthy" ":t" "(if 42 :t :f)"] + ["string truthy" ":t" "(if \"x\" :t :f)"] + ["keyword truthy" ":t" "(if :kw :t :f)"] + ["symbol truthy" ":t" "(if (quote abc) :t :f)"] + ["coll truthy" ":t" "(if [1 2] :t :f)"] + ["map truthy" ":t" "(if {:a 1} :t :f)"] + ["if no else -> nil" "nil" "(if false :t)"]) + +(defspec "truthiness / not" + ["not nil" "true" "(not nil)"] + ["not false" "true" "(not false)"] + ["not zero" "false" "(not 0)"] + ["not empty vector" "false" "(not [])"] + ["not empty string" "false" "(not \"\")"] + ["not number" "false" "(not 42)"] + ["not true" "false" "(not true)"]) + +(defspec "truthiness / and" + ["empty is true" "true" "(and)"] + ["single value" "5" "(and 5)"] + ["all truthy -> last" "3" "(and 1 2 3)"] + ["stops at false" "false" "(and 1 false 3)"] + ["stops at nil" "nil" "(and 1 nil 3)"] + ["false alone" "false" "(and false)"] + ["nil alone" "nil" "(and nil)"] + ["zero is truthy" "0" "(and 1 0)"]) + +(defspec "truthiness / or" + ["empty is nil" "nil" "(or)"] + ["first truthy" "1" "(or 1 2)"] + ["skips nil/false" "5" "(or nil false 5)"] + ["all falsy -> last" "false" "(or nil false)"] + ["nil chain -> false" "false" "(or nil nil nil false)"] + ["zero is truthy" "0" "(or 0 1)"] + ["false alone" "false" "(or false)"]) + +(defspec "truthiness / if-not & boolean" + ["if-not false" ":yes" "(if-not false :yes :no)"] + ["if-not truthy" ":no" "(if-not 0 :yes :no)"] + ["when-not nil" "1" "(when-not nil 1)"] + ["when-not truthy" "nil" "(when-not 5 1)"] + ["boolean of nil" "false" "(boolean nil)"] + ["boolean of false" "false" "(boolean false)"] + ["boolean of 0" "true" "(boolean 0)"] + ["boolean of value" "true" "(boolean :x)"] + ["true?/false?" "true" "(and (true? true) (false? false) (not (true? 1)))"])