rubyx/test/arm/test_translator.rb

31 lines
710 B
Ruby
Raw Normal View History

require_relative 'helper'
module Arm
class TestTranslator < MiniTest::Test
def setup
2019-02-08 22:03:23 +01:00
Parfait.boot!(Parfait.default_test_options)
@jump = Risc::DynamicJump.new("" , :r1)
@codes = Translator.new.translate @jump
end
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
2018-07-27 09:46:22 +02:00
assert_equal 4 , @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
end
end
end