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 / tests / turing / origsel-test.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note omega-mv#700 ORIGSEL evaluator in-process tests (caller unit after origsel.om): ub golden |
| 3 | note values of CODER_SPEC s.8, splitmix64 outputs, binomials, ceil log2, gamma and enumerative |
| 4 | note code lengths, permutation index, order ties, the F1 row rule. Exit 0 = pass, else the |
| 5 | note number of the first failing check. |
| 6 | text TPASS "ORIGSEL_TEST_PASS checks=17\n" |
| 7 | |
| 8 | fn tchk1 to ulong |
| 9 | if ne tqub 1 16000000 |
| 10 | ret 1 |
| 11 | end |
| 12 | if ne tqub 32768 1000000 |
| 13 | ret 2 |
| 14 | end |
| 15 | if ne tqub 43481 591903 |
| 16 | ret 3 |
| 17 | end |
| 18 | if ne tqub 46819 485194 |
| 19 | ret 4 |
| 20 | end |
| 21 | if ne tqub 13107 2321950 |
| 22 | ret 5 |
| 23 | end |
| 24 | if ne tqub 13108 2321840 |
| 25 | ret 6 |
| 26 | end |
| 27 | if ne tqub 65536 0 |
| 28 | ret 7 |
| 29 | end |
| 30 | ret 0 |
| 31 | end |
| 32 | |
| 33 | fn tchk2 to ulong |
| 34 | put TQZ 30 20261025 |
| 35 | if ne tqsm 10346940957598392952 |
| 36 | ret 8 |
| 37 | end |
| 38 | if ne tqsm 10284689419445729823 |
| 39 | ret 9 |
| 40 | end |
| 41 | if or ne tqbin 10 4 210 ne tqbin 3 4 0 |
| 42 | ret 10 |
| 43 | end |
| 44 | if or ne tqclg 1 0 ne tqclg 5 3 |
| 45 | ret 11 |
| 46 | end |
| 47 | if or ne tqpidx tqidp 0 ne tqpidx 4660 119 |
| 48 | ret 12 |
| 49 | end |
| 50 | ret 0 |
| 51 | end |
| 52 | |
| 53 | fn tchk3 to ulong |
| 54 | k = new long 5 0 |
| 55 | put k 0 3 |
| 56 | put k 1 1 |
| 57 | put k 2 1 |
| 58 | put k 3 5 |
| 59 | put k 4 0 |
| 60 | note expected order 4, 1, 2, 0, 3 |
| 61 | if ne tqord5 k 197140 |
| 62 | ret 13 |
| 63 | end |
| 64 | tqwclr |
| 65 | tqgam 1 |
| 66 | tqgam 9 |
| 67 | if ne get TQZ 7 8 |
| 68 | ret 14 |
| 69 | end |
| 70 | for i ulong 200 |
| 71 | put TQN i 0 |
| 72 | end |
| 73 | tqrow 1 0 |
| 74 | if or ne get TQQ 20 13108 ne get TQQ 24 13107 |
| 75 | ret 15 |
| 76 | end |
| 77 | tqwclr |
| 78 | tqwrow 1 0 |
| 79 | if ne get TQZ 7 1 |
| 80 | ret 16 |
| 81 | end |
| 82 | put TQN 20 3 |
| 83 | put TQN 24 2 |
| 84 | tqwclr |
| 85 | tqwrow 1 0 |
| 86 | if ne get TQZ 7 add 5 tqclg tqbin 9 4 |
| 87 | ret 17 |
| 88 | end |
| 89 | ret 0 |
| 90 | end |
| 91 | |
| 92 | fn main to int |
| 93 | e = tchk1 |
| 94 | if eq e 0 |
| 95 | e = tchk2 |
| 96 | end |
| 97 | if eq e 0 |
| 98 | e = tchk3 |
| 99 | end |
| 100 | if ne e 0 |
| 101 | ret int e |
| 102 | end |
| 103 | w = write 1 TPASS 0 len TPASS |
| 104 | ret 0 |
| 105 | end |