flan/test/programs/dyn-char-spell.flan

21 lines
863 B
Plaintext

;;;; Every ASCII code point, the C1 controls, and a few past them, as dyn chars printed one per
;;;; line, each inside a vector, where a char prints as its literal. The test
;;;; reads each back with the reader and wants the same code point, so what a
;;;; char prints as there is what reads as it.
(defn main [] i32
(let [v (vec-new u8)]
(dotimes [i 128] (push v (u8 i)))
(let [t (the dyn (str (slice v)))]
(dotimes [i (length t)] (println [(at t i)])))
;; the C1 controls, U+0080 to U+009F, and U+00A0, each C2 then one byte
(let [w (vec-new u8)]
(dotimes [i 33] (push w (u8 0xC2)) (push w (u8 (+ 0x80 i))))
(let [c1 (the dyn (str (slice w)))]
(dotimes [i (length c1)] (println [(at c1 i)])))
(free w))
(let [u (the dyn "é日😀")]
(dotimes [i (length u)] (println [(at u i)])))
(free v))
0)