2020-03-03 15:09:41 +01:00
|
|
|
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
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_slot_to_reg 1,:message , 6 , :"message.caller"
|
2020-03-03 15:09:41 +01:00
|
|
|
end
|
|
|
|
def test_2_slot
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_slot_to_reg 2,:message , 1 , :"message.next_message"
|
2020-03-03 15:09:41 +01:00
|
|
|
end
|
|
|
|
def test_3_op
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_operator 3, :- , "message.caller" , "message.next_message"
|
2020-03-03 15:09:41 +01:00
|
|
|
end
|
2020-03-08 17:49:35 +01:00
|
|
|
def test_4_not_zero
|
|
|
|
assert_not_zero 4 , "target"
|
2020-03-03 15:09:41 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|