2018-06-24 18:13:55 +02:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
module Arm
|
2018-06-24 23:19:43 +02:00
|
|
|
class TestTranslator < MiniTest::Test
|
2018-06-24 18:13:55 +02:00
|
|
|
|
2018-06-24 23:19:43 +02:00
|
|
|
def setup
|
2018-06-29 23:39:23 +02:00
|
|
|
Parfait.boot!
|
2018-06-24 23:19:43 +02:00
|
|
|
@jump = Risc::DynamicJump.new("" , :r1)
|
|
|
|
@codes = Translator.new.translate @jump
|
2018-06-24 18:13:55 +02:00
|
|
|
end
|
2018-06-24 23:19:43 +02:00
|
|
|
def test_slot_class
|
|
|
|
assert_equal MemoryInstruction , @codes.class
|
|
|
|
end
|
|
|
|
def test_slot_left
|
|
|
|
assert_equal :r1 , @codes.left
|
|
|
|
end
|
|
|
|
def test_slot_result
|
|
|
|
assert_equal :r1 , @codes.left
|
|
|
|
end
|
|
|
|
def test_slot_right
|
|
|
|
assert_equal 16 , @codes.right
|
|
|
|
end
|
|
|
|
def test_next_from
|
|
|
|
assert_equal :r1 , @codes.next.from.symbol
|
|
|
|
end
|
|
|
|
def test_next_class
|
|
|
|
assert_equal MoveInstruction , @codes.next.class
|
2018-06-24 18:13:55 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|