2018-03-17 06:43:44 +01:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
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-03-19 08:49:42 +01:00
|
|
|
@input = "r = 5.mod4"
|
|
|
|
@expect = [Label, LoadConstant, RegToSlot, Label, Label, SlotToReg ,
|
|
|
|
RegToSlot]
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
|
|
|
def test_local_assign_instructions
|
|
|
|
assert_nil msg = check_nil , msg
|
|
|
|
end
|
|
|
|
|
2018-03-19 08:49:42 +01:00
|
|
|
def ttest_constant_load
|
2018-03-17 06:43:44 +01:00
|
|
|
produced = produce_body
|
2018-03-17 16:45:38 +01:00
|
|
|
assert_equal 5 , produced.constant.known_object.value
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
|
|
|
|
2018-03-19 08:49:42 +01:00
|
|
|
def ttest_slot_move
|
2018-03-17 06:43:44 +01:00
|
|
|
produced = produce_body
|
|
|
|
assert_equal produced.next.register , produced.register
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|