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/omega-mv/blob/main/tests/brownian/test_brw_act_report.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / brownian / test_brw_act_report.om` 110 lines ยท 2571 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 note 4 note tests/brownian/test_brw_act_report.om -- Regression tests for BRW-ACT 5 note report statistics in pure seeded OM-2. 6 7 text t_bar_fail "FAIL test_brw_act_report check=" 8 text t_bar_nl "\n" 9 text t_bar_s1 "test_brw_act_report: " 10 text t_bar_s2 " checks, " 11 text t_bar_s3 " failures\n" 12 13 global g_bar_chk ulong 1 14 global g_bar_fl ulong 1 15 global g_bar_o uchar 128 16 17 fn bar_puts s view uchar * to void 18 n = len s 19 for i ulong n 20 put g_bar_o i get s i 21 end 22 _w = write 1 g_bar_o 0 n 23 end 24 25 fn bar_put_u64 v ulong to void 26 if eq v 0 27 put g_bar_o 0 uchar 48 28 _w = write 1 g_bar_o 0 1 29 ret 30 end 31 n = ulong 0 32 x = v 33 while gt x 0 34 put g_bar_o n uchar add 48 rem x 10 35 x = div x 10 36 n = add n 1 37 end 38 i = ulong 0 39 while lt i div n 2 40 j = sub sub n 1 i 41 tmp = get g_bar_o i 42 put g_bar_o i get g_bar_o j 43 put g_bar_o j tmp 44 i = add i 1 45 end 46 _w = write 1 g_bar_o 0 n 47 end 48 49 fn bar_fabs x f64 to f64 50 if lt x f64 0.0 51 ret sub f64 0.0 x 52 end 53 ret x 54 end 55 56 fn chk ok bool id ulong to void 57 put g_bar_chk 0 add get g_bar_chk 0 1 58 if not ok 59 put g_bar_fl 0 add get g_bar_fl 0 1 60 bar_puts t_bar_fail 61 bar_put_u64 id 62 bar_puts t_bar_nl 63 end 64 end 65 66 fn main to int 67 for i ulong 200 68 if lt i 100 69 put g_brw_k i f64 60.0 70 else 71 put g_brw_k i f64 0.0 72 end 73 end 74 brwr_coverage 200 60 75 chk lt bar_fabs sub get g_brw_cov 0 f64 0.5 f64 0.`000000000001` 1 76 w1 = sub get g_brw_cov 2 get g_brw_cov 1 77 chk and gt w1 f64 0.12 lt w1 f64 0.16 2 78 for i ulong 200 79 put g_brw_k i f64 54.0 80 end 81 brwr_coverage 200 60 82 chk and lt bar_fabs sub get g_brw_cov 0 f64 0.9 f64 0.`000000000001` and lt bar_fabs sub get g_brw_cov 1 f64 0.9 f64 0.`000000000001` lt bar_fabs sub get g_brw_cov 2 f64 0.9 f64 0.`000000000001` 3 83 for i ulong 200 84 if lt i 2 85 put g_brw_k i f64 0.0 86 else 87 put g_brw_k i f64 60.0 88 end 89 end 90 brwr_coverage 200 60 91 m = get g_brw_cov 0 92 lo = get g_brw_cov 1 93 hi = get g_brw_cov 2 94 chk and ge lo f64 0.0 and le hi f64 1.0 and le lo m le m hi 4 95 all = brwr_p4 0 10 100 1 96 chk and eq get g_brw_p4 1 1 and eq get g_brw_p4 2 0 eq all 0 5 97 all = brwr_p4 6 0 100 1 98 chk and eq get g_brw_p4 1 0 and eq get g_brw_p4 2 1 eq all 0 6 99 all = brwr_p4 5 10 100 0 100 chk and eq get g_brw_p4 1 1 and eq get g_brw_p4 2 1 eq all 1 7 101 bar_puts t_bar_s1 102 bar_put_u64 get g_bar_chk 0 103 bar_puts t_bar_s2 104 bar_put_u64 get g_bar_fl 0 105 bar_puts t_bar_s3 106 if ne get g_bar_fl 0 0 107 ret 1 108 end 109 ret 0 110 end