2018-05-17 08:31:36 +02:00
|
|
|
require_relative "helper"
|
2018-03-25 18:38:59 +02:00
|
|
|
|
|
|
|
module Risc
|
|
|
|
class TestTranslator < MiniTest::Test
|
|
|
|
|
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-03-25 18:38:59 +02:00
|
|
|
@translator = Arm::Translator.new
|
|
|
|
end
|
|
|
|
|
2018-07-04 08:18:55 +02:00
|
|
|
def test_has_translate
|
|
|
|
assert @translator.respond_to?(:translate)
|
2018-03-25 18:38:59 +02:00
|
|
|
end
|
2018-07-04 08:18:55 +02:00
|
|
|
def test_no_translate_junk
|
|
|
|
assert_raises {@translator.translate( "Hi there")}
|
2018-03-26 18:43:03 +02:00
|
|
|
end
|
2018-07-04 08:18:55 +02: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 10:37:17 +02:00
|
|
|
end
|
2018-03-28 11:50:07 +02:00
|
|
|
|
2018-03-25 18:38:59 +02:00
|
|
|
end
|
|
|
|
end
|