about summary refs log tree commit diff stats
path: root/html/086scenario_console_test.mu.html
blob: 95f75adb0b10584d74f234e45d0365c14e949ddd (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 086scenario_console_test.mu</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim7.4_v2">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; }
body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; }
a { color:#eeeeee; text-decoration: none; }
a:hover { text-decoration: underline; }
* { font-size: 12pt; font-size: 1em; }
.muScenario { color: #00af00; }
.LineNr { color: #444444; }
.Constant { color: #00a0a0; }
.Special { color: #c00000; }
.Comment { color: #9090ff; }
.Comment a { color:#0000ee; text-decoration:underline; }
-->
</style>

<script type='text/javascript'>
<!--

/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
  var lineNum;
  lineNum = window.location.hash;
  lineNum = lineNum.substr(1); /* strip off '#' */

  if (lineNum.indexOf('L') == -1) {
    lineNum = 'L'+lineNum;
  }
  lineElem = document.getElementById(lineNum);
  /* Always jump to new location even if the line was hidden inside a fold, or
   * we corrected the raw number to a line ID.
   */
  if (lineElem) {
    lineElem.scrollIntoView(true);
  }
  return true;
}
if ('onhashchange' in window) {
  window.onhashchange = JumpToLine;
}

-->
</script>
</head>
<body onload='JumpToLine();'>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="Comment"># To check our support for consoles in scenarios, rewrite tests from</span>
<span id="L2" class="LineNr"> 2 </span><span class="Comment"># scenario_console.mu</span>
<span id="L3" class="LineNr"> 3 </span><span class="Comment"># Tests for console interface.</span>
<span id="L4" class="LineNr"> 4 </span>
<span id="L5" class="LineNr"> 5 </span><span class="muScenario">scenario</span> read-key-in-mu [
<span id="L6" class="LineNr"> 6 </span>  assume-console [
<span id="L7" class="LineNr"> 7 </span>    type <span class="Constant">[abc]</span>
<span id="L8" class="LineNr"> 8 </span>  ]
<span id="L9" class="LineNr"> 9 </span>  run [
<span id="L10" class="LineNr">10 </span>    1:char, 2:bool <span class="Special">&lt;-</span> <a href='084console.mu.html#L62'>read-key</a> <a href='084console.mu.html#L23'>console</a>
<span id="L11" class="LineNr">11 </span>    3:char, 4:bool <span class="Special">&lt;-</span> <a href='084console.mu.html#L62'>read-key</a> <a href='084console.mu.html#L23'>console</a>
<span id="L12" class="LineNr">12 </span>    5:char, 6:bool <span class="Special">&lt;-</span> <a href='084console.mu.html#L62'>read-key</a> <a href='084console.mu.html#L23'>console</a>
<span id="L13" class="LineNr">13 </span>    7:char, 8:bool <span class="Special">&lt;-</span> <a href='084console.mu.html#L62'>read-key</a> <a href='084console.mu.html#L23'>console</a>
<span id="L14" class="LineNr">14 </span>  ]
<span id="L15" class="LineNr">15 </span>  memory-should-contain [
<span id="L16" class="LineNr">16 </span>   <span class="Constant"> 1</span> <span class="Special">&lt;-</span><span class="Constant"> 97</span>  <span class="Comment"># 'a'</span>
<span id="L17" class="LineNr">17 </span>   <span class="Constant"> 2</span> <span class="Special">&lt;-</span><span class="Constant"> 1</span>
<span id="L18" class="LineNr">18 </span>   <span class="Constant"> 3</span> <span class="Special">&lt;-</span><span class="Constant"> 98</span>  <span class="Comment"># 'b'</span>
<span id="L19" class="LineNr">19 </span>   <span class="Constant"> 4</span> <span class="Special">&lt;-</span><span class="Constant"> 1</span>
<span id="L20" class="LineNr">20 </span>   <span class="Constant"> 5</span> <span class="Special">&lt;-</span><span class="Constant"> 99</span>  <span class="Comment"># 'c'</span>
<span id="L21" class="LineNr">21 </span>   <span class="Constant"> 6</span> <span class="Special">&lt;-</span><span class="Constant"> 1</span>
<span id="L22" class="LineNr">22 </span>   <span class="Constant"> 7</span> <span class="Special">&lt;-</span><span class="Constant"> 0</span>  <span class="Comment"># eof</span>
<span id="L23" class="LineNr">23 </span>   <span class="Constant"> 8</span> <span class="Special">&lt;-</span><span class="Constant"> 1</span>
<span id="L24" class="LineNr">24 </span>  ]
<span id="L25" class="LineNr">25 </span>]
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
+4) to BL # if (EAX != EBX) return false 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . . # compare EAX and EBX 75/jump-if-not-equal $next-stream-line-equal?:false/disp8 # ++currf 41/increment-ECX # ++currs 42/increment-EDX eb/jump $next-stream-line-equal?:loop/disp8 $next-stream-line-equal?:break: # ++currf 41/increment-ECX # if (currs >= s->length) return true 3b/compare 0/mod/indirect 7/rm32/EDI . . . 2/r32/EDX . . # compare EDX with *EDI 7c/jump-if-lesser $next-stream-line-equal?:false/disp8 $next-stream-line-equal?:true: b8/copy-to-EAX 1/imm32 # persist f->read on success 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 . # copy ECX to *(ESI+4) eb/jump $next-stream-line-equal?:end/disp8 $next-stream-line-equal?:false: b8/copy-to-EAX 0/imm32 $next-stream-line-equal?:end: # . restore registers 5f/pop-to-EDI 5e/pop-to-ESI 5a/pop-to-EDX 59/pop-to-ECX # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return test-next-stream-line-equal-stops-at-newline: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # clear-stream(_test-stream) # . . push args 68/push _test-stream/imm32 # . . call e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write(_test-stream, "Abc\ndef") # . . push args 68/push "Abc\ndef"/imm32 68/push _test-stream/imm32 # . . call e8/call write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # EAX = next-stream-line-equal?(_test-stream, "Abc") # . . push args 68/push "Abc"/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) # . . push args 68/push "F - test-next-stream-line-equal-stops-at-newline"/imm32 68/push 1/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return test-next-stream-line-equal-stops-at-newline-2: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # clear-stream(_test-stream) # . . push args 68/push _test-stream/imm32 # . . call e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write(_test-stream, "Abc\ndef") # . . push args 68/push "Abc\ndef"/imm32 68/push _test-stream/imm32 # . . call e8/call write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # EAX = next-stream-line-equal?(_test-stream, "def") # . . push args 68/push "def"/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 0, msg) # . . push args 68/push "F - test-next-stream-line-equal-stops-at-newline-2"/imm32 68/push 0/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return test-next-stream-line-equal-skips-newline: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # clear-stream(_test-stream) # . . push args 68/push _test-stream/imm32 # . . call e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write(_test-stream, "Abc\ndef\n") # . . push args 68/push "Abc\ndef\n"/imm32 68/push _test-stream/imm32 # . . call e8/call write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # next-stream-line-equal?(_test-stream, "Abc") # . . push args 68/push "Abc"/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # EAX = next-stream-line-equal?(_test-stream, "def") # . . push args 68/push "def"/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) # . . push args 68/push "F - test-next-stream-line-equal-skips-newline"/imm32 68/push 1/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return test-next-stream-line-equal-handles-final-line: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # clear-stream(_test-stream) # . . push args 68/push _test-stream/imm32 # . . call e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write(_test-stream, "Abc\ndef") # . . push args 68/push "Abc\ndef"/imm32 68/push _test-stream/imm32 # . . call e8/call write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # next-stream-line-equal?(_test-stream, "Abc") # . . push args 68/push "Abc"/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # EAX = next-stream-line-equal?(_test-stream, "def") # . . push args 68/push "def"/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) # . . push args 68/push "F - test-next-stream-line-equal-skips-newline"/imm32 68/push 1/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return test-next-stream-line-equal-always-fails-after-Eof: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # clear-stream(_test-stream) # . . push args 68/push _test-stream/imm32 # . . call e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # write nothing # EAX = next-stream-line-equal?(_test-stream, "") # . . push args 68/push ""/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 0, msg) # . . push args 68/push "F - test-next-stream-line-equal-always-fails-after-Eof"/imm32 68/push 1/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # EAX = next-stream-line-equal?(_test-stream, "") # . . push args 68/push ""/imm32 68/push _test-stream/imm32 # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 0, msg) # . . push args 68/push "F - test-next-stream-line-equal-always-fails-after-Eof/2"/imm32 68/push 1/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return # helper for later tests check-next-stream-line-equal: # . prolog 55/push-EBP 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # . save registers 50/push-EAX # EAX = next-stream-line-equal?(f, s) # . . push args ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 . # push *(EBP+12) ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) # . . call e8/call next-stream-line-equal?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP # check-ints-equal(EAX, 1, msg) # . . push args ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 . # push *(EBP+16) 68/push 1/imm32 50/push-EAX # . . call e8/call check-ints-equal/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP # . restore registers 58/pop-to-EAX # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP 5d/pop-to-EBP c3/return # . . vim:nowrap:textwidth=0