2018-05-17 09:31:36 +03:00
|
|
|
require_relative "helper"
|
2018-03-25 19:38:59 +03:00
|
|
|
|
|
|
|
module Risc
|
|
|
|
class TestTranslator < MiniTest::Test
|
|
|
|
|
|
|
|
def setup
|
2019-02-08 23:03:23 +02:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-03-25 19:38:59 +03:00
|
|
|
@translator = Arm::Translator.new
|
|
|
|
end
|
|
|
|
|
2018-07-04 09:18:55 +03:00
|
|
|
def test_has_translate
|
|
|
|
assert @translator.respond_to?(:translate)
|
2018-03-25 19:38:59 +03:00
|
|
|
end
|
2018-07-04 09:18:55 +03:00
|
|
|
def test_no_translate_junk
|
|
|
|
assert_raises {@translator.translate( "Hi there")}
|
2018-03-26 19:43:03 +03:00
|
|
|
end
|
2018-07-04 09:18:55 +03:00
|
|
|
def test_translate_label
|
|
|
|
label = Risc::Label.new("HI","ho" , FakeAddress.new(0))
|
|
|
|
assert_equal "ho" ,label.to_cpu(@translator).name , label
|
2018-03-28 11:37:17 +03:00
|
|
|
end
|
2018-03-28 12:50:07 +03:00
|
|
|
|
2018-03-25 19:38:59 +03:00
|
|
|
end
|
|
|
|
end
|