more stack tests, just to make sure

This commit is contained in:
Torsten Ruger 2014-05-23 15:08:47 +03:00
parent 86e73bf1ba
commit 7b6d6b9024

View File

@ -7,8 +7,25 @@ class TestStack < MiniTest::Test
code = @machine.push [:lr] code = @machine.push [:lr]
assert_code code , :push , [0x00,0x40,0x2d,0xe9] #e9 2d 40 00 assert_code code , :push , [0x00,0x40,0x2d,0xe9] #e9 2d 40 00
end end
def test_push_three
code = @machine.push [:r0,:r1,:lr]
assert_code code , :push , [0x03,0x40,0x2d,0xe9] #e9 2d 40 03
end
def test_push_no_link
code = @machine.push [:r0,:r1,:r2 ,:r3,:r4,:r5]
assert_code code , :push , [0x3f,0x00,0x2d,0xe9] #e9 2d 00 3f
end
def test_pop def test_pop
code = @machine.pop [:pc] code = @machine.pop [:pc]
assert_code code , :pop , [0x00,0x80,0xbd,0xe8] #e8 bd 80 00 assert_code code , :pop , [0x00,0x80,0xbd,0xe8] #e8 bd 80 00
end end
def test_pop_three
code = @machine.pop [:r0,:r1,:pc]
assert_code code , :pop , [0x03,0x80,0xbd,0xe8] #e8 bd 80 03
end
def test_pop_no_pc
code = @machine.pop [:r0,:r1,:r2 ,:r3,:r4,:r5]
assert_code code , :pop , [0x3f,0x00,0xbd,0xe8] #e8 bd 00 3f
end
end end