Typed-array identity + JVM flonum printing (Inc 3)

This commit is contained in:
Yogthos 2026-06-21 22:36:14 -04:00
parent f2747679e9
commit 9e0a930eb4
7 changed files with 85 additions and 57 deletions

View file

@ -2416,10 +2416,10 @@
{:suite "untested / hash family" :label "hash-combine" :expected "true" :actual "(int? (hash-combine 1 2))"}
{:suite "untested / hash family" :label "hash-ordered-coll" :expected "true" :actual "(int? (hash-ordered-coll [1 2]))"}
{:suite "untested / hash family" :label "hash-unordered-coll" :expected "true" :actual "(int? (hash-unordered-coll #{1}))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "make-array" :expected "(quote (nil nil nil))" :actual "(make-array 3)"}
{:suite "untested / array stubs (vectors + host buffers)" :label "into-array" :expected "(quote (1 2))" :actual "(into-array [1 2])"}
{:suite "untested / array stubs (vectors + host buffers)" :label "to-array" :expected "(quote (1 2))" :actual "(to-array [1 2])"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aclone vec" :expected "(quote (1 2))" :actual "(aclone [1 2])"}
{:suite "untested / array stubs (vectors + host buffers)" :label "make-array" :expected "[nil nil nil]" :actual "(vec (make-array Object 3))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "into-array" :expected "[1 2]" :actual "(vec (into-array [1 2]))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "to-array" :expected "[1 2]" :actual "(vec (to-array [1 2]))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aclone vec" :expected "[1 2]" :actual "(vec (aclone (int-array [1 2])))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aclone independent" :expected "[9 2]" :actual "(let [a (aclone (to-array [1 2]))] (aset a 0 9) (seq a))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aset/aget" :expected "9" :actual "(let [a (to-array [1 2 3])] (aset a 0 9) (aget a 0))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aset-int" :expected "7" :actual "(let [a (to-array [1 2])] (aset-int a 0 7) (aget a 0))"}
@ -2430,18 +2430,18 @@
{:suite "untested / array stubs (vectors + host buffers)" :label "aset-float" :expected "2.5" :actual "(let [a (to-array [0])] (aset-float a 0 2.5) (aget a 0))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aset-long" :expected "3" :actual "(let [a (to-array [0])] (aset-long a 0 3) (aget a 0))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "aset-short" :expected "4" :actual "(let [a (to-array [0])] (aset-short a 0 4) (aget a 0))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "boolean-array" :expected "(quote (false false))" :actual "(boolean-array 2)"}
{:suite "untested / array stubs (vectors + host buffers)" :label "int-array" :expected "(quote (1 2))" :actual "(int-array [1 2])"}
{:suite "untested / array stubs (vectors + host buffers)" :label "long-array" :expected "(quote (0 0))" :actual "(long-array 2)"}
{:suite "untested / array stubs (vectors + host buffers)" :label "double-array" :expected "(quote (0 0))" :actual "(double-array 2)"}
{:suite "untested / array stubs (vectors + host buffers)" :label "float-array" :expected "(quote (0 0))" :actual "(float-array 2)"}
{:suite "untested / array stubs (vectors + host buffers)" :label "short-array" :expected "(quote (0 0))" :actual "(short-array 2)"}
{:suite "untested / array stubs (vectors + host buffers)" :label "boolean-array" :expected "[false false]" :actual "(vec (boolean-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "int-array" :expected "[1 2]" :actual "(vec (int-array [1 2]))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "long-array" :expected "[0 0]" :actual "(vec (long-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "double-array" :expected "[0.0 0.0]" :actual "(vec (double-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "float-array" :expected "[0.0 0.0]" :actual "(vec (float-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "short-array" :expected "[0 0]" :actual "(vec (short-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "char-array count" :expected "2" :actual "(count (char-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "byte-array bytes?" :expected "true" :actual "(bytes? (byte-array 2))"}
{:suite "untested / array stubs (vectors + host buffers)" :label "bytes? not vec" :expected "false" :actual "(bytes? [1])"}
{:suite "untested / typed coercion views" :label "booleans" :expected "(quote (true))" :actual "(booleans [true])"}
{:suite "untested / typed coercion views" :label "doubles" :expected "(quote (1))" :actual "(doubles [1.0])"}
{:suite "untested / typed coercion views" :label "floats" :expected "(quote (1))" :actual "(floats [1.0])"}
{:suite "untested / typed coercion views" :label "doubles" :expected "[1.0]" :actual "(vec (doubles (double-array [1.0])))"}
{:suite "untested / typed coercion views" :label "floats" :expected "[1.0]" :actual "(vec (floats (float-array [1.0])))"}
{:suite "untested / typed coercion views" :label "ints" :expected "(quote (1))" :actual "(ints [1])"}
{:suite "untested / typed coercion views" :label "longs" :expected "(quote (1))" :actual "(longs [1])"}
{:suite "untested / typed coercion views" :label "shorts" :expected "(quote (1))" :actual "(shorts [1])"}

View file

@ -129,7 +129,7 @@
{:suite "io" :expr "(do (spit \"/tmp/jolt-io-test.txt\" \"a\") (spit \"/tmp/jolt-io-test.txt\" \"b\" :append true) (slurp \"/tmp/jolt-io-test.txt\"))" :expected "ab"}
{:suite "io" :expr "(flush)" :expected ""}
{:suite "io" :expr "(do (require (quote [clojure.java.io :as io])) (string? (slurp (io/file \"README.md\"))))" :expected "true"}
{:suite "ioreader" :expr "(str (char-array \"abc\"))" :expected "(\\a \\b \\c)"}
{:suite "ioreader" :expr "(apply str (char-array \"abc\"))" :expected "abc"}
{:suite "ioreader" :expr "(.read (StringReader. (apply str (char-array \"Qz\"))))" :expected "81"}
{:suite "ioreader" :expr "(do (require (quote [clojure.java.io :as io])) (.read (io/reader (char-array \"abc\"))))" :expected "97"}
{:suite "ioreader" :expr "(do (require (quote [clojure.java.io :as io])) (.read (io/reader (StringReader. \"k\"))))" :expected "107"}
@ -146,7 +146,7 @@
{:suite "ioreader" :expr "(let [log (atom [])] (try (with-open [c {:close (fn [] (swap! log conj :closed))}] (throw (ex-info \"boom\" {}))) (catch Exception e nil)) (deref log))" :expected "[:closed]"}
{:suite "ioreader" :expr "(let [log (atom [])] (with-open [a {:close (fn [] (swap! log conj :outer))} b {:close (fn [] (swap! log conj :inner))}] :r) (deref log))" :expected "[:inner :outer]"}
{:suite "ioreader" :expr "(with-open [c {:close (fn [] nil) :v 5}] (:v c))" :expected "5"}
{:suite "javastatic" :expr "(Math/sqrt 16)" :expected "4"}
{:suite "javastatic" :expr "(Math/sqrt 16)" :expected "4.0"}
{:suite "javastatic" :expr "(Math/abs -3)" :expected "3"}
{:suite "javastatic" :expr "(Math/max 2 7)" :expected "7"}
{:suite "javastatic" :expr "(pos? Long/MAX_VALUE)" :expected "true"}
@ -289,8 +289,8 @@
{:suite "stdlib" :expr "(long (clojure.math/pow 2 10))" :expected "1024"}
{:suite "stdlib" :expr "(long (clojure.math/tan 0))" :expected "0"}
{:suite "stdlib" :expr "(clojure.math/round 2.6)" :expected "3"}
{:suite "stdlib" :expr "(clojure.math/floor 2.9)" :expected "2"}
{:suite "stdlib" :expr "(clojure.math/signum -7.2)" :expected "-1"}
{:suite "stdlib" :expr "(clojure.math/floor 2.9)" :expected "2.0"}
{:suite "stdlib" :expr "(clojure.math/signum -7.2)" :expected "-1.0"}
{:suite "stdlib" :expr "(< 3.14 (clojure.math/to-radians 180) 3.15)" :expected "true"}
{:suite "stdlib" :expr "(< 3.14 clojure.math/PI 3.15)" :expected "true"}
{:suite "stdlib" :expr "(< 2.71 clojure.math/E 2.72)" :expected "true"}

View file

@ -2,11 +2,11 @@
"Rows of test/chez/corpus.edn whose :expected differs from reference JVM Clojure. The corpus is JVM-sourced (regen-corpus.clj), so this list is only the rows whose JVM value is an opaque host object that cannot round-trip to readable source — Java arrays, transients, atoms, beans, proxies, and chunks print as #object[..@addr] with a per-run identity — plus the (fn* foo) strictness case and a few racy concurrency cases (:flaky). For those the corpus keeps jolt's value. certify.clj gates on NEW (unlisted) divergences and STALE entries. Keyed by [suite label].",
:legend
{:numeric-model
"jolt is all-double: no Ratio/BigDecimal/float; (/ 1 2)=>0.5, 3.0 prints 3",
"jolt has a numeric tower (exact integer / Ratio / double); no BigDecimal",
:concurrency-model
"Janet isolated-heap snapshot futures/agents/pmap; atoms snapshot, not shared",
:host-model
"no JVM host: classes->name strings, no Java arrays, type->symbol, *in* is a map, inline-impl extenders, duck-typed with-open close",
"no JVM host: classes->name strings, type->symbol, *in* is a map, inline-impl extenders, duck-typed with-open close",
:reader-model
"jolt reader features (:jolt) + syntax-quote literal collapse (spec 2.4 S25); map source-order preserved",
:printer-model
@ -49,30 +49,6 @@
{:suite "untested / JVM-shape stubs (documented jolt behavior)",
:label "proxy resolves nil",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "boolean-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "double-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "float-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "int-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "into-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "long-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "short-array",
:category :host-model}
{:suite "untested / array stubs (vectors + host buffers)",
:label "to-array",
:category :host-model}
{:suite "untested / chunk family (eager equivalents) + cat",
:label "chunk round-trip",
:category :host-model}]}