bic, and and adc tests
This commit is contained in:
parent
5d9c4323bb
commit
a9d0ee2754
@ -21,7 +21,7 @@ class TestArmAsm < MiniTest::Test
|
|||||||
assert_equal 4 , binary.length
|
assert_equal 4 , binary.length
|
||||||
index = 0
|
index = 0
|
||||||
binary.each_byte do |byte |
|
binary.each_byte do |byte |
|
||||||
assert_equal should[index] , byte
|
assert_equal should[index] , byte , "byte #{index} 0x#{should[index].to_s(16)} != 0x#{byte.to_s(16)}"
|
||||||
index += 1
|
index += 1
|
||||||
end
|
end
|
||||||
assert code.affect_status if status #no s at the end, silly for mov anyway
|
assert code.affect_status if status #no s at the end, silly for mov anyway
|
||||||
@ -30,6 +30,18 @@ class TestArmAsm < MiniTest::Test
|
|||||||
code = @generator.instance_eval { adc r1, r3, r5}.first
|
code = @generator.instance_eval { adc r1, r3, r5}.first
|
||||||
assert_code code , :adc , [0x05,0x10,0xa3,0xe0]
|
assert_code code , :adc , [0x05,0x10,0xa3,0xe0]
|
||||||
end
|
end
|
||||||
|
def test_add
|
||||||
|
code = @generator.instance_eval { add r1 , r1, r3}.first
|
||||||
|
assert_code code , :add , [0x03,0x10,0x81,0xe0]
|
||||||
|
end
|
||||||
|
def test_and # inst eval doesn't really work with and
|
||||||
|
code = @generator.and( [:reg , 'r1'] , [:reg , 'r2'] , [:reg , 'r3']).first
|
||||||
|
assert_code code , :and , [0x03,0x10,0x02,0xe0]
|
||||||
|
end
|
||||||
|
def test_bic
|
||||||
|
code = @generator.instance_eval { bic r2 , r2 , 0x44 }.first
|
||||||
|
assert_code code , :bic , [0x44,0x20,0xc2,0xe3]
|
||||||
|
end
|
||||||
def test_mov
|
def test_mov
|
||||||
code = @generator.instance_eval { mov r0, 5 }.first
|
code = @generator.instance_eval { mov r0, 5 }.first
|
||||||
assert_code code , :mov , [0x05,0x00,0xa0,0xe3]
|
assert_code code , :mov , [0x05,0x00,0xa0,0xe3]
|
||||||
|
Loading…
Reference in New Issue
Block a user