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