last split control/stack tests

This commit is contained in:
Torsten Ruger 2014-05-19 11:27:20 +03:00
parent 76f1537174
commit db4f074b75
3 changed files with 17 additions and 10 deletions

View File

@ -1,4 +1,5 @@
require_relative "test_arm" require_relative "test_stack"
require_relative "test_control"
require_relative "test_logic" require_relative "test_logic"
require_relative "test_move" require_relative "test_move"
require_relative "test_memory" require_relative "test_memory"

View File

@ -1,6 +1,6 @@
require_relative 'helper' require_relative 'helper'
class TestArmAsm < MiniTest::Test class TestControl < MiniTest::Test
include ArmHelper include ArmHelper
def test_b def test_b
@ -14,14 +14,6 @@ class TestArmAsm < MiniTest::Test
code = @machine.call -4 ,{} #this jumps to the next instruction code = @machine.call -4 ,{} #this jumps to the next instruction
assert_code code , :call, [0xff,0xff,0xff,0xeb] #ea ff ff fe assert_code code , :call, [0xff,0xff,0xff,0xeb] #ea ff ff fe
end end
def test_push
code = @machine.push [:lr]
assert_code code , :push , [0x00,0x40,0x2d,0xe9] #e9 2d 40 00
end
def test_pop
code = @machine.pop [:pc]
assert_code code , :pop , [0x00,0x80,0xbd,0xe8] #e8 bd 80 00
end
def test_swi def test_swi
code = @machine.swi 0x05 code = @machine.swi 0x05
assert_code code , :swi , [0x05,0x00,0x00,0xef]#ef 00 00 05 assert_code code , :swi , [0x05,0x00,0x00,0xef]#ef 00 00 05

14
test/arm/test_stack.rb Normal file
View File

@ -0,0 +1,14 @@
require_relative 'helper'
class TestStack < MiniTest::Test
include ArmHelper
def test_push
code = @machine.push [:lr]
assert_code code , :push , [0x00,0x40,0x2d,0xe9] #e9 2d 40 00
end
def test_pop
code = @machine.pop [:pc]
assert_code code , :pop , [0x00,0x80,0xbd,0xe8] #e8 bd 80 00
end
end