much love
[mu.git] / 502test.mu
blob8a5e167e9bc954c9d1eefd3ad50cafc889fa48a4
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   move-cursor-to-left-margin-of-next-line 0/screen
12   count-test-failure
15 fn test-check-ints-equal {
16   check-ints-equal 0, 0, "abc"
19 fn check _a: boolean, msg: (addr array byte) {
20   var a/eax: int <- copy _a
21   compare a, 0/false
22   {
23     break-if-=
24     draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg=cyan, 0/bg
25     return
26   }
27   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg=cyan, 0/bg
28   move-cursor-to-left-margin-of-next-line 0/screen
29   count-test-failure
32 fn check-not _a: boolean, msg: (addr array byte) {
33   var a/eax: int <- copy _a
34   compare a, 0/false
35   {
36     break-if-!=
37     draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg=cyan, 0/bg
38     return
39   }
40   draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg=cyan, 0/bg
41   move-cursor-to-left-margin-of-next-line 0/screen
42   count-test-failure