fix all tests accordingly to new return

This commit is contained in:
Torsten Ruger
2018-08-02 17:37:27 +03:00
parent 5346077a72
commit 308996bf8e
37 changed files with 161 additions and 155 deletions

View File

@ -9,6 +9,7 @@ module Risc
@input = "@ivar = 5"
@expect = [LoadConstant, SlotToReg, RegToSlot]
end
def test_local_assign_instructions
assert_nil msg = check_nil , msg
end

View File

@ -12,7 +12,8 @@ module Risc
[ Label ]
end
def postamble
[ Label ]
[Label, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, SlotToReg, FunctionReturn, Label]
end
# test hack to in place change object type
def add_space_field(name,type)
@ -35,7 +36,7 @@ module Risc
end
def check_nil
produced = produce_instructions
compare_instructions produced , @expect
compare_instructions( produced , @expect)
end
def check_return
was = check_nil

View File

@ -12,9 +12,7 @@ module Risc
RegToSlot, RegToSlot, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
SlotToReg, FunctionCall, Label, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
FunctionReturn]
RegToSlot, SlotToReg, SlotToReg, RegToSlot, Branch]
end
def test_return_instructions
@ -22,7 +20,8 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal FunctionReturn , produced.next(35).class
assert_equal Branch , produced.next(29).class
assert_equal "return_label" , produced.next(29).label.name
end
def test_load_5
produced = produce_body

View File

@ -21,8 +21,7 @@ module Risc
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, RegToSlot, SlotToReg, LoadConstant, SlotToReg,
DynamicJump, Label, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn]
SlotToReg, SlotToReg, RegToSlot, Branch]
end
def test_return_instructions
@ -30,9 +29,9 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal FunctionReturn , produced.next(79).class
assert_equal Branch , produced.next(73).class
end
def test_cache_check
def est_cache_check
produced = produce_body
assert_equal IsZero , produced.next(6).class
end

View File

@ -7,8 +7,7 @@ module Risc
def setup
super
@input = "return 5"
@expect = [LoadConstant, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, SlotToReg, SlotToReg, FunctionReturn]
@expect = [LoadConstant, RegToSlot, Branch]
end
def test_return_instructions
@ -16,7 +15,7 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal FunctionReturn , produced.next(8).class
assert_equal Branch , produced.next(2).class
end
def test_load_5
produced = produce_body