Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cortex/blob/main/tests/fts/t_like.om # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / tests / fts / t_like.om` 176 lines ยท 3050 bytes Raw Blame History 1 note ===== tests/fts/t_like.om : LIKE differential harness ===== 2 note usage: t_like DUMP PATTERNS > out ; per pattern "p ok|err n= " where bit j 3 note is set when entity j (dump order = rowid order) has canonical_name LIKE p OR content LIKE p 4 note (answered as the server does: like_find for the '%' literal '%' patterns like_lit accepts, 5 note like_test for the others) 6 note content bytes span tcb, tcb1, tcb2 (16 MiB each; one pool holds at most `16777216` elements): 7 note the live content passed 16 MiB on 2026-10-26 (`16834750` bytes, 6641 entities; trap 3) 8 global tcb uchar `16777216` 9 global tcb1 uchar `16777216` 10 global tcb2 uchar `16777216` 11 global tco ulong 65536 12 global tnb uchar `1048576` 13 global tno ulong 65536 14 global tbm uchar 65536 15 text tlk1 " ok n=" 16 text tlk2 " err n=" 17 fn main to int 18 nen = t_lload 19 fp = t_open 2 20 put tibn 0 0 21 put tibp 0 0 22 pi = ulong 0 23 while t_need fp 4 bound 999999 24 t_rdpat fp 25 t_lone pi nen 26 pi = add pi 1 27 end 28 t_flush 29 ret 0 30 end 31 note skip the FTS rows, load the entities (name, content) into tnb/tcb 32 fn t_lload to ulong 33 fd = t_open 1 34 z = t_need fd 12 35 put tibp 0 8 36 nf = t_u32 37 for r ulong nf 38 z = t_need fd 8 39 row = t_u64 40 for k ulong 5 41 b = t_rdsb fd 42 end 43 z = t_need fd 1 44 put tibp 0 add get tibp 0 1 45 end 46 z = t_need fd 4 47 nen = t_u32 48 co = ulong 0 49 no = ulong 0 50 for e ulong nen 51 z = t_need fd 8 52 row = t_u64 53 b = t_rdsb fd 54 put tno e no 55 no = t_cpn no 56 t_rdct fd 57 put tco e co 58 co = t_cpc co 59 end 60 put tno nen no 61 put tco nen co 62 ret nen 63 end 64 fn t_cpn o ulong to ulong 65 n = get tsbn 0 66 for i ulong n 67 put tnb add o i get tsb i 68 end 69 ret add o n 70 end 71 fn t_cpc o ulong to ulong 72 n = get qctl 0 73 for i ulong n 74 tc_put add o i get qct i 75 end 76 ret add o n 77 end 78 fn t_rdpat fp int to void 79 n = t_u32 80 z = t_need fp n 81 p = get tibp 0 82 for i ulong n 83 put qlp i get tib add p i 84 end 85 put tibp 0 add p n 86 put qlpl 0 n 87 end 88 fn t_lone pi ulong nen ulong to void 89 for i ulong add div nen 8 1 90 put tbm i 0 91 end 92 ok = like_set 93 lit = like_lit 94 c = ulong 0 95 if ok 96 for e ulong nen 97 if t_lent e lit 98 t_bset e 99 c = add c 1 100 end 101 end 102 end 103 t_ch 112 104 t_dec pi 105 if ok 106 for i ulong len tlk1 107 t_ch ulong get tlk1 i 108 end 109 else 110 for i ulong len tlk2 111 t_ch ulong get tlk2 i 112 end 113 end 114 t_dec c 115 t_ch 32 116 for i ulong div add nen 7 8 117 t_hex ulong get tbm i 2 118 end 119 t_ch 10 120 end 121 fn t_lent e ulong lit bool to bool 122 a = get tno e 123 n = sub get tno add e 1 a 124 for i ulong n 125 put qct i get tnb add a i 126 end 127 put qctl 0 n 128 if t_lt lit 129 ret true 130 end 131 a = get tco e 132 n = sub get tco add e 1 a 133 for i ulong n 134 put qct i tc_get add a i 135 end 136 put qctl 0 n 137 ret t_lt lit 138 end 139 fn t_lt lit bool to bool 140 if lit 141 ret like_find 142 end 143 ret like_test 144 end 145 fn t_bset e ulong to void 146 k = div e 8 147 v = ulong get tbm k 148 put tbm k uchar or v shl ulong 1 rem e 8 149 end 150 151 fn tc_put i ulong v uchar to void 152 k = div i `16777216` 153 j = rem i `16777216` 154 note Omega has no elif (it parses as an assignment to a local named elif), so each branch 155 note returns on its own 156 if eq k 0 157 put tcb j v 158 ret 159 end 160 if eq k 1 161 put tcb1 j v 162 ret 163 end 164 put tcb2 j v 165 end 166 fn tc_get i ulong to uchar 167 k = div i `16777216` 168 j = rem i `16777216` 169 if eq k 0 170 ret get tcb j 171 end 172 if eq k 1 173 ret get tcb1 j 174 end 175 ret get tcb2 j 176 end