From 105e8f7092c0e40360c38f4e3ec9d64869d00d83 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 28 Mar 2018 12:16:28 +0300 Subject: [PATCH] some better and some missing arm test for the exceptional case --- test/arm/test_logic.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/arm/test_logic.rb b/test/arm/test_logic.rb index e96af290..bc9bb6f7 100644 --- a/test/arm/test_logic.rb +++ b/test/arm/test_logic.rb @@ -80,15 +80,24 @@ module Arm code = @machine.add :r1 , :r1, 0x220 assert_code code , :add , [0x22,0x1e,0x91,0xe2] #e2 91 1e 22 end + def test_too_big_add + code = @machine.add :r1 , :r1, 0x222 + begin # add 0x02 (first instruction) and then 0x220 shifted + assert_code code , :add , [0x02,0x1c,0x91,0xe2, 0x22,0x10,0x91,0xe2] #e2 91 1e 22 + rescue Risc::LinkException + retry + end + end - def label pos = 0x22 + def label pos = 0x22 + 8 l = Risc.label("some" , "Label") l.set_position pos l end - def pest_move_object + def test_move_object code = @machine.add( :r1 , label) + code.set_position(0) assert_code code , :add , [0x22,0x10,0x9f,0xe2] #e2 9f 10 22 end