about summary refs log tree commit diff stats
path: root/tangle
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-11-18 00:24:24 -0800
committerKartik Agaram <vc@akkartik.com>2019-11-18 00:24:24 -0800
commit0ea0ebcf81afc722f731b22a1e1d5d7819830efd (patch)
tree02b82a483a7e29817350b7710ead1bbf9cdb6ae5 /tangle
parent3b40e3c331312c78d252fab02bd5f8dd53ce59f4 (diff)
downloadmu-0ea0ebcf81afc722f731b22a1e1d5d7819830efd.tar.gz
5751 - start of table of Mu primitives
So far this is just the same as our most recent tests. But now we have a
'DSL' for adding more primitives.
Diffstat (limited to 'tangle')
0 files changed, 0 insertions, 0 deletions
akkartik/mu/commit/502test.mu?h=hlt&id=cec5ef31b3e383b7bdffe049a8c502a563f6b491'>cec5ef31 ^
dfa61e62 ^
21bddb2e ^




f3f6bc3f ^









cec5ef31 ^
f3f6bc3f ^











cec5ef31 ^
f3f6bc3f ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43




                                                             
               
                                                                                                  
          
   
                                                                                                
                                                  
                    




                              









                                                                                                  
                                                  











                                                                                                  
                                                  

                    
# print msg to screen if a != b, otherwise print "."
fn check-ints-equal _a: int, b: int, msg: (addr array byte) {
  var a/eax: int <- copy _a
  compare a, b
  {
    break-if-!=
    draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
    return
  }
  draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
  move-cursor-to-left-margin-of-next-line 0/screen
  count-test-failure
}

fn test-check-ints-equal {
  check-ints-equal 0, 0, "abc"
}

fn check _a: boolean, msg: (addr array byte) {
  var a/eax: int <- copy _a
  compare a, 0/false
  {
    break-if-=
    draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
    return
  }
  draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
  move-cursor-to-left-margin-of-next-line 0/screen
  count-test-failure
}

fn check-not _a: boolean, msg: (addr array byte) {
  var a/eax: int <- copy _a
  compare a, 0/false
  {
    break-if-!=
    draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ".", 3/fg/cyan, 0/bg
    return
  }
  draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
  move-cursor-to-left-margin-of-next-line 0/screen
  count-test-failure
}