rubyx/test/slot_machine/test_slotted_message2.rb

29 lines
844 B
Ruby
Raw Normal View History

require_relative "helper"
module SlotMachine
2020-02-17 08:27:42 +01:00
class TestSlottedMessage2 < MiniTest::Test
def setup
2019-02-08 22:03:23 +01:00
Parfait.boot!(Parfait.default_test_options)
compiler = Risc.test_compiler
2020-02-17 08:45:54 +01:00
slotted = SlottedMessage.new([:caller])
2020-02-17 08:26:50 +01:00
@register = slotted.to_register(compiler , "fake source")
@instruction = compiler.risc_instructions.next
end
def test_def_class
assert_equal Risc::SlotToReg , @instruction.class
end
def test_def_next_class
assert_equal NilClass , @instruction.next.class
end
def test_def_array #from message r0
assert_equal :r0 , @instruction.array.symbol
end
def test_def_register # to next free register r1
assert_equal :r2 , @register.symbol
end
def test_def_index # at caller index 6
assert_equal 6 , @instruction.index
end
end
end