rubyx/test/risc/test_interpreter_platform.rb

41 lines
1.0 KiB
Ruby
Raw Normal View History

require_relative "helper"
module Risc
class TestInterpreterPlatform < MiniTest::Test
def setup
@inter = Platform.for("Interpreter")
end
def test_platform_class
assert_equal Risc::InterpreterPlatform , @inter.class
end
def test_platform_translator_class
assert_equal Risc::IdentityTranslator , @inter.translator.class
end
def test_platform_loaded_class
assert_equal ::Integer , @inter.loaded_at.class
end
def test_translator
assert IdentityTranslator.new
end
2020-02-26 18:01:01 +01:00
def test_registers
assert_equal 16 , @inter.num_registers
end
end
class TestIdentityTranslator < MiniTest::Test
def setup
2019-02-08 22:03:23 +01:00
Parfait.boot!(Parfait.default_test_options)
2018-07-02 22:20:54 +02:00
Risc.boot!
@translator = IdentityTranslator.new
end
def test_load_translates_label
label = Risc.label("test" , "test",nil)
load = Risc.load_constant("source" , label , :r1)
translated = @translator.translate(load)
assert label != translated.constant
end
end
end