put arm tests in arm module
This commit is contained in:
parent
a14a0de9d1
commit
da58ce30e3
@ -4,7 +4,8 @@ require_relative "../helper"
|
|||||||
# one instruction at a time, reverse testing from objdump --demangle -Sfghxp
|
# one instruction at a time, reverse testing from objdump --demangle -Sfghxp
|
||||||
# tests are named as per assembler code, ie test_mov testing mov instruction
|
# tests are named as per assembler code, ie test_mov testing mov instruction
|
||||||
|
|
||||||
module ArmHelper
|
module Arm
|
||||||
|
module ArmHelper
|
||||||
def setup
|
def setup
|
||||||
@machine = Arm::ArmMachine
|
@machine = Arm::ArmMachine
|
||||||
end
|
end
|
||||||
@ -23,4 +24,5 @@ module ArmHelper
|
|||||||
index += 1
|
index += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestControl < MiniTest::Test
|
module Arm
|
||||||
|
class TestControl < MiniTest::Test
|
||||||
include ArmHelper
|
include ArmHelper
|
||||||
|
|
||||||
def test_b
|
def test_b
|
||||||
@ -23,4 +24,5 @@ class TestControl < MiniTest::Test
|
|||||||
assert_code @machine.swi("0x05") , :swi , [0x05,0x00,0x00,0xef]
|
assert_code @machine.swi("0x05") , :swi , [0x05,0x00,0x00,0xef]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestArmAsm < MiniTest::Test
|
module Arm
|
||||||
|
class TestArmAsm < MiniTest::Test
|
||||||
include ArmHelper
|
include ArmHelper
|
||||||
|
|
||||||
def test_cmn
|
def test_cmn
|
||||||
@ -27,4 +28,5 @@ class TestArmAsm < MiniTest::Test
|
|||||||
code = @machine.tst :r2 , :r2
|
code = @machine.tst :r2 , :r2
|
||||||
assert_code code , :tst , [0x02,0x00,0x12,0xe1] #e1 12 00 02
|
assert_code code , :tst , [0x02,0x00,0x12,0xe1] #e1 12 00 02
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestLogic < MiniTest::Test
|
module Arm
|
||||||
|
class TestLogic < MiniTest::Test
|
||||||
include ArmHelper
|
include ArmHelper
|
||||||
|
|
||||||
def test_mul1
|
def test_mul1
|
||||||
@ -91,4 +92,5 @@ class TestLogic < MiniTest::Test
|
|||||||
assert_code code , :add , [0x22,0x10,0x9f,0xe2] #e2 9f 10 22
|
assert_code code , :add , [0x22,0x10,0x9f,0xe2] #e2 9f 10 22
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestMemory < MiniTest::Test
|
module Arm
|
||||||
|
class TestMemory < MiniTest::Test
|
||||||
include ArmHelper
|
include ArmHelper
|
||||||
|
|
||||||
def test_ldr
|
def test_ldr
|
||||||
@ -71,4 +72,5 @@ class TestMemory < MiniTest::Test
|
|||||||
code = @machine.strb :r1, :r2 , :r3
|
code = @machine.strb :r1, :r2 , :r3
|
||||||
assert_code code, :strb , [0x03,0x10,0xc2,0xe7] #e7 c2 10 03
|
assert_code code, :strb , [0x03,0x10,0xc2,0xe7] #e7 c2 10 03
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestMoves < MiniTest::Test
|
module Arm
|
||||||
|
class TestMoves < MiniTest::Test
|
||||||
include ArmHelper
|
include ArmHelper
|
||||||
|
|
||||||
def test_mov
|
def test_mov
|
||||||
@ -59,4 +60,5 @@ class TestMoves < MiniTest::Test
|
|||||||
assert_code code , :mov , [0x34,0x35,0xb0,0xe1] #e1 b0 35 34
|
assert_code code , :mov , [0x34,0x35,0xb0,0xe1] #e1 b0 35 34
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
require_relative 'helper'
|
require_relative 'helper'
|
||||||
|
|
||||||
class TestStack < MiniTest::Test
|
module Arm
|
||||||
|
class TestStack < MiniTest::Test
|
||||||
include ArmHelper
|
include ArmHelper
|
||||||
|
|
||||||
def test_push
|
def test_push
|
||||||
@ -28,4 +29,5 @@ class TestStack < MiniTest::Test
|
|||||||
assert_code code , :pop , [0x3f,0x00,0xbd,0xe8] #e8 bd 00 3f
|
assert_code code , :pop , [0x3f,0x00,0xbd,0xe8] #e8 bd 00 3f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user