2019-09-15 17:31:10 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 19:55:41 +02:00
|
|
|
module SlotMachine
|
|
|
|
class TesBlockYield < SlotMachineInstructionTest
|
2019-09-15 17:31:10 +02:00
|
|
|
def instruction
|
|
|
|
BlockYield.new("source",1)
|
|
|
|
end
|
|
|
|
def test_len
|
|
|
|
assert_equal 8 , all.length , all_str
|
|
|
|
end
|
2020-03-03 15:22:50 +01:00
|
|
|
def test_1_load
|
|
|
|
assert_load risc(1) , Risc::Label , "id_"
|
|
|
|
assert_label risc(1).constant , "continue_"
|
2019-09-15 17:31:10 +02:00
|
|
|
end
|
2020-03-03 15:22:50 +01:00
|
|
|
def test_2_slot
|
|
|
|
assert_slot_to_reg risc(2) ,:message , 1 , "message.next_message"
|
2019-09-15 17:31:10 +02:00
|
|
|
end
|
|
|
|
def test_3_reg
|
2020-03-03 15:22:50 +01:00
|
|
|
assert_reg_to_slot risc(3) , "id_" , "message.next_message" , 4
|
2019-09-15 17:31:10 +02:00
|
|
|
end
|
|
|
|
def test_4_slot
|
2020-03-03 15:22:50 +01:00
|
|
|
assert_slot_to_reg risc(4) ,:message , 9 , "message.arg1"
|
2019-09-15 17:31:10 +02:00
|
|
|
end
|
2020-03-03 15:22:50 +01:00
|
|
|
def test_5_swap
|
|
|
|
assert_slot_to_reg risc(5) ,:message , 1 , :message
|
2019-09-15 17:31:10 +02:00
|
|
|
end
|
|
|
|
def test_6_jump
|
|
|
|
assert_equal Risc::DynamicJump , risc(6).class
|
2020-03-03 15:22:50 +01:00
|
|
|
assert_equal :"message.arg1" , risc(6).register.symbol
|
2019-09-15 17:31:10 +02:00
|
|
|
end
|
|
|
|
def test_7_label
|
|
|
|
assert_label risc(7) , "continue_"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|