2018-03-19 16:28:53 +05:30
|
|
|
require_relative '../helper'
|
2018-03-17 11:13:44 +05:30
|
|
|
|
|
|
|
module Risc
|
2018-03-19 13:19:42 +05:30
|
|
|
class TestAssignLocalSend < MiniTest::Test
|
2018-03-17 11:13:44 +05:30
|
|
|
include Statements
|
|
|
|
|
|
|
|
def setup
|
2019-09-12 22:27:10 +03:00
|
|
|
@preload = "Integer.div4"
|
2019-08-17 23:29:42 +03:00
|
|
|
@input = "r = 5.div4;return"
|
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, LoadConstant, #15
|
|
|
|
RegToSlot, Branch,] #20
|
2018-03-17 11:13:44 +05:30
|
|
|
end
|
|
|
|
def test_local_assign_instructions
|
|
|
|
assert_nil msg = check_nil , msg
|
|
|
|
end
|
|
|
|
|
2018-03-21 18:54:42 +05:30
|
|
|
def test_constant_load
|
2018-03-17 11:13:44 +05:30
|
|
|
produced = produce_body
|
2019-08-23 19:24:18 +03:00
|
|
|
load = produced.next(3)
|
2018-04-06 23:37:41 +03:00
|
|
|
assert_equal LoadConstant , load.class
|
|
|
|
assert_equal 5 , load.constant.value
|
2018-03-17 11:13:44 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|