2018-04-05 19:10:00 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Risc
|
|
|
|
class TestMessageSetupSimple < MiniTest::Test
|
|
|
|
include Statements
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
2019-08-17 22:29:42 +02:00
|
|
|
@input = "return 5.div4"
|
2019-08-23 18:24:18 +02:00
|
|
|
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
|
|
|
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10
|
|
|
|
FunctionCall, Label, SlotToReg, RegToSlot, Branch,] #15
|
2018-04-05 19:10:00 +02:00
|
|
|
@produced = produce_body
|
|
|
|
end
|
|
|
|
|
2018-04-06 21:54:54 +02:00
|
|
|
def test_send_instructions
|
2018-04-05 19:10:00 +02:00
|
|
|
assert_nil msg = check_nil , msg
|
|
|
|
end
|
2019-08-23 14:31:04 +02:00
|
|
|
def test_load_method
|
2018-04-05 19:10:00 +02:00
|
|
|
method = @produced
|
2018-07-07 08:11:09 +02:00
|
|
|
assert_load( method, Parfait::CallableMethod ,:r1)
|
2018-04-19 09:00:55 +02:00
|
|
|
assert_equal :div4 , method.constant.name
|
2018-04-05 19:10:00 +02:00
|
|
|
end
|
2019-08-23 14:31:04 +02:00
|
|
|
def test_store_method_in_message
|
2019-08-23 18:24:18 +02:00
|
|
|
sl = @produced.next( 2 )
|
2019-08-23 14:31:04 +02:00
|
|
|
assert_reg_to_slot( sl , :r1 , :r2 , 7 )
|
2018-08-19 16:29:04 +02:00
|
|
|
end
|
2018-04-05 19:10:00 +02:00
|
|
|
end
|
|
|
|
end
|