more test fixing

only one bug to go
This commit is contained in:
Torsten Ruger
2018-05-24 21:20:56 +03:00
parent bf23883270
commit 8d8cc4b016
27 changed files with 332 additions and 348 deletions

View File

@ -9,11 +9,15 @@ module Arm
def byte_length
4
end
def is_a?(_)
true
end
end
module ArmHelper
def setup
@machine = Arm::ArmMachine
@binary = FakeBin.new
Risc::Position.clear_positions
Risc::Position.set(@binary , 0)
end

View File

@ -82,7 +82,7 @@ module Arm
end
def test_too_big_add
code = @machine.add :r1 , :r1, 0x222
Risc::Position.set(code,0,@binary)
Risc::Position.set(code,0,nil)
# add 0x02 (first instruction) and then 0x220 shifted
assert_code code , :add , [0x02,0x1c,0x91,0xe2] #e2 91 1e 02
# added extra instruction to add "extra"

View File

@ -22,7 +22,7 @@ module Arm
end
def test_mov_big
code = @machine.mov :r0, 0x222 # is not 8 bit and can't be rotated by the arm system in one instruction
Risc::Position.set(code,0,@binary)
Risc::Position.set(code,0, nil)
# mov 512(0x200) = e3 a0 0c 02 add 34(0x22) = e2 90 00 22
assert_code code , :mov , [ 0x02,0x0c,0xb0,0xe3]
assert_code code.next , :add , [ 0x22,0x00,0x90,0xe2]