2019-09-15 16:44:35 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 19:55:41 +02:00
|
|
|
module SlotMachine
|
|
|
|
class TestDynamicCall < SlotMachineInstructionTest
|
2019-09-15 16:44:35 +02:00
|
|
|
def instruction
|
|
|
|
DynamicCall.new(nil,nil)
|
|
|
|
end
|
|
|
|
def test_len
|
|
|
|
assert_equal 9 , all.length , all_str
|
|
|
|
end
|
|
|
|
def test_1_load
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_load 1, Parfait::CacheEntry , "id_"
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
|
|
|
def test_2_slot
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_slot_to_reg 2, "id_" , 2 , "id_.cached_method"
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
2020-03-03 15:44:21 +01:00
|
|
|
def test_3_load
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_load 3, Risc::Label , "id_"
|
|
|
|
assert_label risc(3).constant , "continue_" , 3
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
|
|
|
def test_4_slot
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_slot_to_reg 4, :message , 1 , "message.next_message"
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
2020-03-03 15:44:21 +01:00
|
|
|
def test_5_reg
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_reg_to_slot 5, "id_" , "message.next_message" , 4
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
|
|
|
def test_6_slot
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_slot_to_reg 6, :message , 1 , :message
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
|
|
|
def test_7_jump
|
|
|
|
assert_equal Risc::DynamicJump , risc(7).class
|
2020-03-03 15:44:21 +01:00
|
|
|
assert_register :jump , "id_.cached_method" , risc(7).register
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
|
|
|
def test_8_label
|
2020-03-08 16:31:16 +01:00
|
|
|
assert_label 8, "continue_"
|
2019-09-15 16:44:35 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|