2019-09-15 18:57:15 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 19:55:41 +02:00
|
|
|
module SlotMachine
|
2020-03-03 15:09:41 +01:00
|
|
|
class TestTruthCheck < 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
|
2020-03-01 17:07:42 +01:00
|
|
|
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
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_slot_to_reg 1,:message , 6 , :"message.caller"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
def test_2_load
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_load 2, Parfait::FalseClass, "id_"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
def test_3_op
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_operator 3, :- , "id_" , "message.caller"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
def test_4_zero
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_not_zero 4 , "target"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
def test_5_load
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_load 5, Parfait::NilClass , "id_"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
def test_6_op
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_operator 6, :- , "id_", "message.caller"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
def test_7_zero
|
2020-03-08 16:31:39 +01:00
|
|
|
assert_not_zero 7 , "target"
|
2019-09-15 18:57:15 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|