rubyx/test/mom/send/test_send_dynamic.rb

51 lines
1.9 KiB
Ruby
Raw Normal View History

2018-04-05 11:19:29 +02:00
require_relative "../helper"
module Risc
class TestSendDynamic < MiniTest::Test
include Statements
def setup
super
@input = "@a.mod4"
2018-04-03 13:31:49 +02:00
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction,
IsZero, SlotToReg, SlotToReg, LoadConstant, RegToSlot,
2018-04-06 22:37:41 +02:00
LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, SlotToReg, LoadConstant, FunctionCall, Label,
SlotToReg, LoadConstant, RegToSlot, Label, LoadConstant,
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
DynamicJump]
end
def test_send_instructions
assert_nil msg = check_nil , msg
end
def test_function_call
produced = produce_body
2018-04-06 22:37:41 +02:00
assert_equal DynamicJump , produced.next(65).class
end
def test_load_address
produced = produce_body
2018-04-06 22:37:41 +02:00
assert_equal LoadConstant , produced.next(63).class
assert_equal Parfait::CacheEntry , produced.next(63).constant.class
end
def test_cache_check
produced = produce_body
2018-03-24 17:33:19 +01:00
assert_equal IsZero , produced.next(5).class
2018-04-06 22:37:41 +02:00
assert_equal Label , produced.next(43).class
assert_equal produced.next(43) , produced.next(5).label
end
def test_check_resolve
produced = produce_body
2018-04-06 22:37:41 +02:00
assert_equal FunctionCall , produced.next(38).class
assert_equal :resolve_method ,produced.next(38).method.name
end
end
end