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 / aienux / allen / tests / font.om
| 1 | global Oldmask uchar 65536 |
| 2 | global Oldmeta ulong 6 |
| 3 | fn test ok bool to void |
| 4 | check ok add get Checks 0 1 |
| 5 | end |
| 6 | fn asym to bool |
| 7 | w = get Af 3 |
| 8 | for y ulong get Af 4 |
| 9 | at = mul y w |
| 10 | for x ulong w |
| 11 | a = long get Alpha add at x |
| 12 | mirror = add at sub sub w 1 x |
| 13 | b = long get Alpha mirror |
| 14 | d = sub a b |
| 15 | if gt d 40 |
| 16 | ret false |
| 17 | end |
| 18 | if lt d -40 |
| 19 | ret false |
| 20 | end |
| 21 | end |
| 22 | end |
| 23 | ret true |
| 24 | end |
| 25 | fn main to int |
| 26 | test not afglyph 65 |
| 27 | test not afinit 0 1250 |
| 28 | test not afinit 65 1250 |
| 29 | test not afinit 30 0 |
| 30 | test not afinit 30 2501 |
| 31 | test afinit 30 1250 |
| 32 | test eq get Af 0 384 |
| 33 | test eq get Af 1 480 |
| 34 | test eq afsqrt 0 0 |
| 35 | test eq afsqrt 15 3 |
| 36 | test eq afsqrt 16 4 |
| 37 | test eq afsqrt 18446744073709551615 4294967295 |
| 38 | test eq afsqrt mul ulong 1000000007 1000000007 1000000007 |
| 39 | test eq afsin 0 0 |
| 40 | test eq afsin 90 16384 |
| 41 | test eq afsin -90 -16384 |
| 42 | test eq afsin 450 16384 |
| 43 | test eq afcos 180 -16384 |
| 44 | for c ulong 95 |
| 45 | test afglyph uchar add c 32 |
| 46 | test gt get Af 5 0 |
| 47 | test le mul get Af 3 get Af 4 len Alpha |
| 48 | if eq c 0 |
| 49 | test eq get Af 3 0 |
| 50 | test eq get Af 4 1 |
| 51 | else |
| 52 | ink = ulong 0 |
| 53 | for i ulong mul get Af 3 get Af 4 |
| 54 | if gt get Alpha i 128 |
| 55 | ink = add ink 1 |
| 56 | end |
| 57 | end |
| 58 | test ge ink 4 |
| 59 | end |
| 60 | end |
| 61 | test afglyph 111 |
| 62 | test asym |
| 63 | test afglyph 63 |
| 64 | for i ulong mul get Af 3 get Af 4 |
| 65 | put Oldmask i get Alpha i |
| 66 | end |
| 67 | for i ulong 6 |
| 68 | put Oldmeta i get Af i |
| 69 | end |
| 70 | test afglyph 0 |
| 71 | same = true |
| 72 | for i ulong 6 |
| 73 | if ne get Oldmeta i get Af i |
| 74 | same = false |
| 75 | end |
| 76 | end |
| 77 | for i ulong mul get Af 3 get Af 4 |
| 78 | if ne get Oldmask i get Alpha i |
| 79 | same = false |
| 80 | end |
| 81 | end |
| 82 | test same |
| 83 | test not afinit 999 1250 |
| 84 | test eq get Af 0 get Oldmeta 0 |
| 85 | test eq get Af 3 get Oldmeta 3 |
| 86 | test afinit 64 2500 |
| 87 | test afglyph 87 |
| 88 | test le mul get Af 3 get Af 4 len Alpha |
| 89 | test afinit 1 1 |
| 90 | test afglyph 65 |
| 91 | note Independent analytic coverage for round-capped strokes and zero-length dots. |
| 92 | put Af 2 1 |
| 93 | put Af 1 128 |
| 94 | put Ag 0 0 |
| 95 | put Ag 1 0 |
| 96 | put Ag 2 512 |
| 97 | put Ag 3 0 |
| 98 | test eq afalpha 256 0 255 |
| 99 | test eq afalpha 256 128 127 |
| 100 | test eq afalpha 256 256 0 |
| 101 | test eq afalpha 768 0 0 |
| 102 | test eq afalpha -128 0 127 |
| 103 | put Ag 0 512 |
| 104 | put Ag 2 0 |
| 105 | test eq afalpha 256 128 127 |
| 106 | put Ag 0 0 |
| 107 | test eq afalpha 0 0 255 |
| 108 | test eq afalpha 0 128 127 |
| 109 | test eq afalpha 0 256 0 |
| 110 | if ne get Fails 0 0 |
| 111 | ret 1 |
| 112 | end |
| 113 | ret 0 |
| 114 | end |