rubyx/test/slot_machine/instructions/test_same_check.rb
Torsten a4c0b8e5f9 did return sequence
surprisingly easy. also some check polish
2020-03-22 14:31:43 +02:00

29 lines
825 B
Ruby

require_relative "helper"
module SlotMachine
class TestSameCheck < SlotMachineInstructionTest
def instruction
left = SlottedMessage.new( [:caller])
right = SlottedMessage.new( [:next_message])
SameCheck.new(left , right , Label.new("ok" , "target"))
end
def test_len
assert_equal 5 , all.length
assert_equal Risc::Label , all.first.class
end
def test_1_slot
assert_slot_to_reg risc(1) ,:message , 6 , :"message.caller"
end
def test_2_slot
assert_slot_to_reg risc(2) ,:message , 1 , :"message.next_message"
end
def test_3_op
assert_operator risc(3) , :- , "message.caller" , "message.next_message"
end
def test_4_zero
assert_equal Risc::IsNotZero , risc(4).class
assert_label risc(4).label , "target"
end
end
end