2018-05-16 12:49:46 +03:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 20:55:41 +03:00
|
|
|
module SlotMachine
|
2020-02-17 14:27:42 +07:00
|
|
|
class TestSlottedMessage2 < MiniTest::Test
|
2018-05-16 12:49:46 +03:00
|
|
|
def setup
|
2019-02-08 23:03:23 +02:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2020-02-28 12:54:17 +02:00
|
|
|
compiler = Risc.test_compiler
|
2020-02-17 14:45:54 +07:00
|
|
|
slotted = SlottedMessage.new([:caller])
|
2020-02-17 14:26:50 +07:00
|
|
|
@register = slotted.to_register(compiler , "fake source")
|
2020-02-28 12:54:17 +02:00
|
|
|
@instruction = compiler.risc_instructions.next
|
2018-05-16 12:49:46 +03: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
|
2020-02-29 17:19:53 +02:00
|
|
|
assert_equal :message , @instruction.array.symbol
|
2018-05-16 12:49:46 +03:00
|
|
|
end
|
|
|
|
def test_def_register # to next free register r1
|
2020-02-29 17:19:53 +02:00
|
|
|
assert_equal :"message.caller" , @register.symbol
|
2018-05-16 12:49:46 +03:00
|
|
|
end
|
|
|
|
def test_def_index # at caller index 6
|
|
|
|
assert_equal 6 , @instruction.index
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|