2018-05-16 11:49:46 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 19:55:41 +02:00
|
|
|
module SlotMachine
|
2020-02-11 10:19:52 +01:00
|
|
|
class TestSlotKnown1 < MiniTest::Test
|
2018-05-16 11:49:46 +02:00
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2020-02-17 08:26:50 +01:00
|
|
|
compiler = Risc::FakeCompiler.new
|
|
|
|
slotted = SlottedMessage.new(:caller)
|
|
|
|
@register = slotted.to_register(compiler , "fake source")
|
|
|
|
@instruction = compiler.instructions.first
|
2018-05-16 11:49:46 +02:00
|
|
|
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
|
2018-08-19 11:56:44 +02:00
|
|
|
assert_equal :r1 , @register.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_def_index # at caller index 6
|
|
|
|
assert_equal 6 , @instruction.index
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|