2019-08-13 18:32:17 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Risc
|
|
|
|
class TestBlockAssign < MiniTest::Test
|
|
|
|
include Statements
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
2019-08-13 19:35:27 +02:00
|
|
|
@input = as_block("a = 5")
|
|
|
|
@expect = [LoadConstant, SlotToReg, RegToSlot]
|
2019-08-13 18:32:17 +02:00
|
|
|
end
|
|
|
|
def test_send_instructions
|
|
|
|
assert_nil msg = check_nil(produce_block) , msg
|
|
|
|
end
|
|
|
|
def test_load_5
|
2019-08-13 19:35:27 +02:00
|
|
|
produced = produce_block.next
|
2019-08-13 18:32:17 +02:00
|
|
|
assert_load( produced , Parfait::Integer)
|
|
|
|
assert_equal 5 , produced.constant.value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|