2018-05-16 11:49:46 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
|
|
|
class TestSlotLoad1 < MiniTest::Test
|
|
|
|
|
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-08-19 12:06:00 +02:00
|
|
|
load = SlotLoad.new( [:message, :caller] , [:message,:type] )
|
2018-07-16 10:46:18 +02:00
|
|
|
@compiler = Risc::FakeCompiler.new
|
2018-08-19 12:06:00 +02:00
|
|
|
load.to_risc(@compiler)
|
|
|
|
@instructions = @compiler.instructions
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_ins_class
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal Risc::SlotToReg , @instructions[0].class
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_next_class
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal Risc::RegToSlot , @instructions[1].class
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_arr
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal :r0 , @instructions[0].array.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_reg
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal :r1 , @instructions[0].register.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_index
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal 0 , @instructions[0].index
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_next_reg
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal :r1 , @instructions[1].register.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_next_arr
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal :r0 , @instructions[1].array.symbol
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
def test_ins_next_index
|
2018-08-19 12:06:00 +02:00
|
|
|
assert_equal 6 , @instructions[1].index
|
2018-05-16 11:49:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|