rubyx/test/slot_machine/instruction/test_truth_check.rb

38 lines
1021 B
Ruby
Raw Normal View History

2019-09-15 18:57:15 +02:00
require_relative "helper"
module SlotMachine
class TestSameCheck < SlotMachineInstructionTest
2019-09-15 18:57:15 +02:00
def instruction
2020-02-17 08:45:54 +01:00
target = SlottedMessage.new( [:caller])
2019-09-15 18:57:15 +02:00
TruthCheck.new(target , Label.new("ok" , "target"))
end
def test_len
assert_equal 8 , all.length
assert_equal Risc::Label , all.first.class
2019-09-15 18:57:15 +02:00
end
def test_1_slot
assert_slot_to_reg risc(1) ,:message , 6 , :"message.caller"
2019-09-15 18:57:15 +02:00
end
def test_2_load
assert_load risc(2) , Parfait::FalseClass, "id_"
2019-09-15 18:57:15 +02:00
end
def test_3_op
assert_operator risc(3) , :- , "id_" , "message.caller"
2019-09-15 18:57:15 +02:00
end
def test_4_zero
assert_equal Risc::IsZero , risc(4).class
assert_label risc(4).label , "target"
end
def test_5_load
assert_load risc(5) , Parfait::NilClass , "id_"
2019-09-15 18:57:15 +02:00
end
def test_6_op
assert_operator risc(6), :- , "id_", "message.caller"
2019-09-15 18:57:15 +02:00
end
def test_7_zero
assert_equal Risc::IsZero , risc(7).class
assert_label risc(7).label , "target"
end
end
end