fixes all but interpreter tests

This commit is contained in:
Torsten Ruger
2018-04-06 23:37:41 +03:00
parent eea92399ee
commit 3c90eb31c6
9 changed files with 111 additions and 105 deletions

View File

@ -9,18 +9,18 @@ module Risc
@input = "@a.mod4"
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction,
IsZero, SlotToReg, SlotToReg, LoadConstant, RegToSlot,
LoadConstant, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, RegToSlot, SlotToReg, LoadConstant, FunctionCall,
Label, SlotToReg, LoadConstant, RegToSlot, Label,
LoadConstant, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, DynamicJump]
LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, SlotToReg, LoadConstant, FunctionCall, Label,
SlotToReg, LoadConstant, RegToSlot, Label, LoadConstant,
LoadConstant, SlotToReg, RegToSlot, RegToSlot, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
DynamicJump]
end
def test_send_instructions
@ -28,23 +28,23 @@ module Risc
end
def test_function_call
produced = produce_body
assert_equal DynamicJump , produced.next(67).class
assert_equal DynamicJump , produced.next(65).class
end
def test_load_address
produced = produce_body
assert_equal LoadConstant , produced.next(65).class
assert_equal Parfait::CacheEntry , produced.next(65).constant.class
assert_equal LoadConstant , produced.next(63).class
assert_equal Parfait::CacheEntry , produced.next(63).constant.class
end
def test_cache_check
produced = produce_body
assert_equal IsZero , produced.next(5).class
assert_equal Label , produced.next(44).class
assert_equal produced.next(44) , produced.next(5).label
assert_equal Label , produced.next(43).class
assert_equal produced.next(43) , produced.next(5).label
end
def test_check_resolve
produced = produce_body
assert_equal FunctionCall , produced.next(39).class
assert_equal :resolve_method ,produced.next(39).method.name
assert_equal FunctionCall , produced.next(38).class
assert_equal :resolve_method ,produced.next(38).method.name
end
end
end