interplane.Get Omega
Read in your language

cortex

aien-dev/cortex

Brought by drakestapleton

branch main Branches Tags History

cortex / tests / json / t_json.om

72 lines · 1109 bytes Raw Blame History
1note tests/json/t_json.om - differential harness: per input document two records,
2note A = from_slice::<Value> (canonical text or category + message),
3note C = js_canon_buf over the same bytes (via jes) followed by js_canon of the A tree again (the tree
4note must survive canon_buf), B = axum-style prefix parse + serde_path_to_error path. Needs t_io.om.
5fn t_jem to void
6for i ulong get jeml 0
7js_byte get jem i
8end
9end
10fn t_res ok bool pfx bool to void
11put jobl 0 0
12if ok
13js_byte 79
14js_canon get jroot 0
15else
16js_byte 69
17js_byte add 48 get jecat 0
18if pfx
19if js_path
20js_byte 58
21js_byte 32
22end
23end
24t_jem
25end
26t_emitjob
27end
28fn t_cpes n ulong to void
29i = ulong 0
30for b ulong 4000
31for c ulong 4000
32if ge i n
33ret
34end
35x = get jin i
36put jes i x
37i = add i 1
38end
39end
40end
41fn t_canb a bool to void
42n = get jinl 0
43t_cpes n
44put jobl 0 0
45js_byte 79
46if js_canon_buf 0 n
47if a
48js_byte 124
49js_canon get jroot 0
50else
51js_byte 63
52end
53else
54put jobl 0 0
55js_byte 70
56end
57t_emitjob
58end
59fn main to int
60num_init
61for it ulong 100000000
62if not t_rec
63t_flush
64ret 0
65end
66a = js_parse
67t_res a false
68t_canb a
69t_res js_parsep true
70end
71ret 1
72end