rubyx/test/slot_machine/instruction/test_slot2.rb
Torsten Rüger 3c762c4fe7 Rename SlotDefinition to Slot
And the derived XXDefinitions to XXSlot

Just to be more consistent
And possibly free the Definition for the Language side
2020-02-11 16:19:52 +07:00

29 lines
846 B
Ruby

require_relative "helper"
module SlotMachine
class TestSlotKnown1 < MiniTest::Test
def setup
Parfait.boot!(Parfait.default_test_options)
@compiler = Risc::FakeCompiler.new
@definition = MessageSlot.new( :caller)
@register = @definition.to_register(@compiler , "fake source")
@instruction = @compiler.instructions.first
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 :r1 , @register.symbol
end
def test_def_index # at caller index 6
assert_equal 6 , @instruction.index
end
end
end