2018-03-19 11:58:53 +01:00
|
|
|
require_relative '../helper'
|
2018-03-17 06:43:44 +01:00
|
|
|
|
|
|
|
module Risc
|
2018-03-19 08:49:42 +01:00
|
|
|
class TestAssignLocalSend < MiniTest::Test
|
2018-03-17 06:43:44 +01:00
|
|
|
include Statements
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
2018-04-19 09:00:55 +02:00
|
|
|
@input = "r = 5.div4"
|
2018-08-12 14:02:23 +02:00
|
|
|
@expect = [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
|
|
|
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg,
|
|
|
|
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
|
|
|
|
FunctionCall, Label, SlotToReg, SlotToReg, RegToSlot]
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
2019-08-13 10:14:36 +02:00
|
|
|
def test_local_assign_instructions
|
2018-03-17 06:43:44 +01:00
|
|
|
assert_nil msg = check_nil , msg
|
|
|
|
end
|
|
|
|
|
2019-08-13 10:14:36 +02:00
|
|
|
def test_constant_load
|
2018-03-17 06:43:44 +01:00
|
|
|
produced = produce_body
|
2018-08-12 14:02:23 +02:00
|
|
|
load = produced.next(8)
|
2018-04-06 22:37:41 +02:00
|
|
|
assert_equal LoadConstant , load.class
|
|
|
|
assert_equal 5 , load.constant.value
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|