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
|
|
|
|
super
|
2018-04-19 10:00:55 +03:00
|
|
|
@input = "r = 5.div4"
|
2018-04-06 23:37:41 +03:00
|
|
|
@expect = [LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
|
|
|
|
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
|
|
|
RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot,
|
|
|
|
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
2018-05-24 19:38:48 +03:00
|
|
|
RegToSlot, SlotToReg, FunctionCall, Label, SlotToReg,
|
|
|
|
SlotToReg, RegToSlot]
|
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
|
2018-04-06 23:37:41 +03:00
|
|
|
load = produced.next(15)
|
|
|
|
assert_equal LoadConstant , load.class
|
|
|
|
assert_equal 5 , load.constant.value
|
2018-03-17 11:13:44 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|