https://github.com/akkartik/mu/blob/main/baremetal/502test.mu
 1 # print msg to screen if a != b, otherwise print "."
 2 fn check-ints-equal _a: int, b: int, msg: (addr array byte) {
 3   var a/eax: int <- copy _a
 4   compare a, b
 5   {
 6     break-if-!=
 7     draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
 8     return
 9   }
10   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
11   count-test-failure
12 }
13 
14 fn test-check-ints-equal {
15   check-ints-equal 0, 0, "abc"
16 }
17 
18 fn check _a: boolean, msg: (addr array byte) {
19   var a/eax: int <- copy _a
20   compare a, 0/false
21   {
22     break-if-=
23     draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
24     return
25   }
26   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
27   count-test-failure
28 }
29 
30 fn check-not _a: boolean, msg: (addr array byte) {
31   var a/eax: int <- copy _a
32   compare a, 0/false
33   {
34     break-if-!=
35     draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
36     return
37   }
38   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
39   count-test-failure
40 }