2019-09-17 09:16:59 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-10-03 19:55:41 +02:00
|
|
|
module SlotMachine
|
|
|
|
class TestMessageSetupInt < SlotMachineInstructionTest
|
2019-09-17 09:16:59 +02:00
|
|
|
def instruction
|
|
|
|
MessageSetup.new( 1 )
|
|
|
|
end
|
|
|
|
def test_len
|
|
|
|
assert_equal 4 , all.length , all_str
|
|
|
|
end
|
|
|
|
def test_1_slot
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_slot_to_reg risc(1) ,:message , 9 , :"message.arg1"
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
|
|
|
def test_2_slot
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_slot_to_reg risc(2) ,:message , 1 , :"message.next_message"
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
2019-09-17 12:52:20 +02:00
|
|
|
def test_3_reg
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_reg_to_slot risc(3) , :"message.arg1" , :"message.next_message" , 7
|
2019-09-17 12:52:20 +02:00
|
|
|
end
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
2019-10-03 19:55:41 +02:00
|
|
|
class TestMessageSetupCache < SlotMachineInstructionTest
|
2019-09-17 09:16:59 +02:00
|
|
|
include Parfait::MethodHelper
|
|
|
|
|
|
|
|
def instruction
|
|
|
|
method = make_method
|
|
|
|
cache_entry = Parfait::CacheEntry.new(method.frame_type, method)
|
|
|
|
MessageSetup.new( cache_entry )
|
|
|
|
end
|
|
|
|
def test_len
|
|
|
|
assert_equal 5 , all.length , all_str
|
|
|
|
end
|
|
|
|
def test_1_load
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_load risc(1) , Parfait::CacheEntry , "id_"
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
|
|
|
def test_2_slot
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_slot_to_reg risc(2) ,"id_" , 2 , "id_.cached_method"
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
|
|
|
def test_3_slot
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_slot_to_reg risc(3) ,:message , 1 , :"message.next_message"
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
|
|
|
def test_4_reg
|
2020-03-02 16:50:49 +01:00
|
|
|
assert_reg_to_slot risc(4) , "id_.cached_method" , :"message.next_message" , 7
|
2019-09-17 09:16:59 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|