omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / text / tests / boundaries.om
| 1 | note Boundary contract for seed/text, composed before text.om by boundary.cases. |
| 2 | note A selector runs one case; the cases file supplies exact exits, never inferred outputs. |
| 3 | om2 |
| 4 | |
| 5 | fn untouched a view uchar * to int |
| 6 | for i ulong len a |
| 7 | if ne get a i 17 |
| 8 | ret 1 |
| 9 | end |
| 10 | end |
| 11 | ret 0 |
| 12 | end |
| 13 | |
| 14 | fn emptychecks a view uchar * b view uchar * to int |
| 15 | if not tx_eq part a 4 0 part b 4 0 |
| 16 | ret 1 |
| 17 | end |
| 18 | if ne tx_cmp part a 4 0 part b 4 0 0 |
| 19 | ret 2 |
| 20 | end |
| 21 | if ne tx_find part a 4 0 part b 4 0 0 0 |
| 22 | ret 3 |
| 23 | end |
| 24 | if ne tx_field part a 4 0 17 0 0 |
| 25 | ret 4 |
| 26 | end |
| 27 | if ne tx_u8ok a 4 0 4 |
| 28 | ret 5 |
| 29 | end |
| 30 | if ne tx_u8dec a 4 0 18446744073709551615 |
| 31 | ret 6 |
| 32 | end |
| 33 | v = new ulong 1 123 |
| 34 | if ne tx_pdec a 4 0 v long -1 |
| 35 | ret 7 |
| 36 | end |
| 37 | if ne get v 0 123 |
| 38 | ret 8 |
| 39 | end |
| 40 | ret 0 |
| 41 | end |
| 42 | |
| 43 | fn main to int |
| 44 | arg = new uchar 1 0 |
| 45 | if ne argread 1 arg 0 1 1 |
| 46 | ret 90 |
| 47 | end |
| 48 | sel = get arg 0 |
| 49 | a = new uchar 4 17 |
| 50 | b = new uchar 4 17 |
| 51 | v = new ulong 1 123 |
| 52 | if eq sel 48 |
| 53 | ret emptychecks a b |
| 54 | end |
| 55 | if eq sel 49 |
| 56 | tx_slice 4 18446744073709551615 2 |
| 57 | ret 0 |
| 58 | end |
| 59 | if eq sel 50 |
| 60 | tx_slice 4 1 18446744073709551615 |
| 61 | ret 0 |
| 62 | end |
| 63 | if eq sel 51 |
| 64 | tx_slice 4 5 0 |
| 65 | ret 0 |
| 66 | end |
| 67 | if eq sel 52 |
| 68 | if ne tx_fdec 18446744073709551615 a 0 long -4 |
| 69 | ret 1 |
| 70 | end |
| 71 | ret untouched a |
| 72 | end |
| 73 | if eq sel 53 |
| 74 | if ne tx_fdeci long -9223372036854775808 a 0 long -4 |
| 75 | ret 1 |
| 76 | end |
| 77 | ret untouched a |
| 78 | end |
| 79 | if eq sel 54 |
| 80 | r = tx_fhex 1 17 a 0 |
| 81 | ret 0 |
| 82 | end |
| 83 | if eq sel 55 |
| 84 | if ne tx_u8enc 55296 a 0 long -3 |
| 85 | ret 1 |
| 86 | end |
| 87 | ret untouched a |
| 88 | end |
| 89 | if eq sel 56 |
| 90 | u = tx_u8dec a 3 2 |
| 91 | ret 0 |
| 92 | end |
| 93 | if eq sel 57 |
| 94 | r = tx_pdec a 3 2 v |
| 95 | ret 0 |
| 96 | end |
| 97 | if eq sel 97 |
| 98 | if ne tx_u8enc 1114111 a 1 long -4 |
| 99 | ret 1 |
| 100 | end |
| 101 | ret untouched a |
| 102 | end |
| 103 | if eq sel 98 |
| 104 | if ne tx_find a b 18446744073709551615 18446744073709551615 |
| 105 | ret 1 |
| 106 | end |
| 107 | if ne tx_field a 17 18446744073709551615 18446744073709551615 |
| 108 | ret 2 |
| 109 | end |
| 110 | ret 0 |
| 111 | end |
| 112 | if eq sel 99 |
| 113 | r = tx_fdec 1 a 5 |
| 114 | ret 0 |
| 115 | end |
| 116 | if eq sel 100 |
| 117 | u = tx_u8ok a 1 18446744073709551615 |
| 118 | ret 0 |
| 119 | end |
| 120 | ret 91 |
| 121 | end |