rubyx/test/mom/send/test_send_simple.rb

44 lines
1.3 KiB
Ruby
Raw Normal View History

2018-04-05 11:19:29 +02:00
require_relative "../helper"
module Risc
class TestCallSimple < MiniTest::Test
include Statements
def setup
super
2018-04-19 09:00:55 +02:00
@input = "5.div4"
2018-04-06 22:37:41 +02:00
@expect = [LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, RegToSlot, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
SlotToReg, FunctionCall, Label]
end
def test_send_instructions
assert_nil msg = check_nil , msg
end
2018-03-30 17:13:17 +02:00
def test_load_5
2018-03-21 17:35:51 +01:00
produced = produce_body
assert_equal 5 , produced.next(14).constant.value
2018-03-21 17:35:51 +01:00
end
def test_load_label
produced = produce_body
assert_equal Label , produced.next(17).constant.class
end
def test_call_reg_setup
produced = produce_body
assert_equal :div4 , produced.next(21).method.name
end
2018-03-30 17:13:17 +02:00
def test_function_call
produced = produce_body
assert_equal FunctionCall , produced.next(21).class
assert_equal :div4 , produced.next(21).method.name
2018-03-30 17:13:17 +02:00
end
def test_check_continue
produced = produce_body
assert produced.next(22).name.start_with?("continue_")
2018-03-30 17:13:17 +02:00
end
#TODO check the message setup, type and frame moves
end
end