test(spec): numbers, strings, predicates — fix variadic <, seq?, index-of

Add spec suites for numbers/arithmetic, strings (str + clojure.string), and
type/value predicates. Bugs they caught and fixed:
- <, >, <=, >= were binary-only; now variadic ((< 1 2 3) chains)
- seq? was true for vectors; vectors are not ISeq in Clojure, so (seq? [1])
  is now false (true only for lists/lazy-seqs)
- clojure.string/index-of and last-index-of were 1-based (stray inc); now
  0-based per Clojure

Corrected a systematic-coverage assertion that encoded the old seq? bug.
jpm test green, conformance 218/218.
This commit is contained in:
Yogthos 2026-06-05 00:13:19 -04:00
parent b353d625f1
commit 68d6b1d6c1
6 changed files with 178 additions and 12 deletions

View file

@ -108,24 +108,23 @@
s)))
(defn index-of
"0-based index of the first occurrence of value in s, or nil."
([s value]
(let [idx (str-find value s)]
(when idx (inc idx))))
(str-find value s))
([s value from]
(let [idx (str-find value (subs s from))]
(when idx (+ from (inc idx))))))
(when idx (+ from idx)))))
(defn last-index-of
([s value]
(let [r (str-reverse-b s) sval (str-reverse-b value)
idx (str-find sval r)]
(when idx (inc (- (count s) (+ idx (count value)))))))
(when idx (- (count s) (+ idx (count value))))))
([s value from]
(let [sub (subs s 0 from) r (str-reverse-b sub) sval (str-reverse-b value)
idx (str-find sval r)]
(when idx (inc (- from (+ idx (count value))))))))
(when idx (- from (+ idx (count value)))))))
(defn re-quote-replacement
"Escape special characters (backslash and dollar) in a regex replacement