2018-05-16 11:49:46 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
|
|
|
class TestSlotDefinitionKnown2 < MiniTest::Test
|
|
|
|
def setup
|
2018-07-01 13:12:42 +02:00
|
|
|
Parfait.boot!
|
2018-07-16 10:46:18 +02:00
|
|
|
@compiler = Risc::FakeCompiler.new
|
2018-05-16 11:49:46 +02:00
|
|
|
@definition = SlotDefinition.new(:message , [:caller , :type])
|
2018-08-19 11:56:44 +02:00
|
|
|
@register = @definition.to_register(@compiler , InstructionMock.new)
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_def_next_class
|
2018-08-19 11:56:44 +02:00
|
|
|
assert_equal Risc::SlotToReg , @compiler.instructions[1].class
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_def_next_next_class
|
2018-08-19 11:56:44 +02:00
|
|
|
assert_equal NilClass , @compiler.instructions[2].class
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_def_next_index
|
2018-08-19 11:56:44 +02:00
|
|
|
assert_equal 0 , @compiler.instructions[1].index
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_def_next_register
|
2018-08-19 11:56:44 +02:00
|
|
|
assert_equal :r1 , @compiler.instructions[1].register.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_def_next_array
|
2018-08-19 11:56:44 +02:00
|
|
|
assert_equal :r1 , @compiler.instructions[1].array.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|