random tries

This commit is contained in:
Torsten Ruger
2018-03-15 10:46:17 +05:30
parent 0a9997f549
commit 163cad456f
7 changed files with 16 additions and 21 deletions

View File

@ -41,9 +41,7 @@ module Risc
end
def check_nil
assert @expect , "No output given"
Vool::VoolCompiler.ruby_to_vool "class Space; def main(arg);#{@input};end;end"
produced = Parfait.object_space.get_main.instructions
compare_instructions produced , @expect
end

View File

@ -5,22 +5,16 @@ module Risc
class TestAssignStatement < MiniTest::Test
include Statements
def test_assign_local_assign
def pest_assign_local_assign
Parfait.object_space.get_main.add_local(:r , :Integer)
@input = "r = 5"
@expect = [LoadConstant, RegToSlot]
assert_nil msg = check_nil , msg
end
def pest_assign_op
Parfait.object_space.get_main.add_local(:r , :Integer)
@input = "r = 10.mod4"
@expect = [Label, LoadConstant, SlotToReg, RegToSlot, Label, FunctionReturn]
assert_nil msg = check_nil , msg
end