rubyx/test/slot_machine/instructions/test_block_yield.rb

36 lines
912 B
Ruby
Raw Normal View History

require_relative "helper"
module SlotMachine
class TesBlockYield < SlotMachineInstructionTest
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
2020-03-08 16:31:16 +01:00
assert_load 1, Risc::Label , "id_"
assert_label risc(1).constant , "continue_" ,1
end
2020-03-03 15:22:50 +01:00
def test_2_slot
2020-03-08 16:31:16 +01:00
assert_slot_to_reg 2,:message , 1 , "message.next_message"
end
def test_3_reg
2020-03-08 16:31:16 +01:00
assert_reg_to_slot 3, "id_" , "message.next_message" , 4
end
def test_4_slot
2020-03-08 16:31:16 +01:00
assert_slot_to_reg 4,:message , 9 , "message.arg1"
end
2020-03-03 15:22:50 +01:00
def test_5_swap
2020-03-08 16:31:16 +01:00
assert_slot_to_reg 5,:message , 1 , :message
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
end
def test_7_label
2020-03-08 16:31:16 +01:00
assert_label 7, "continue_"
end
end
end