generalise the operator handling

ie passing them through
implementing more
This commit is contained in:
Torsten Ruger
2018-04-19 22:13:52 +03:00
parent 7d9132ee36
commit 9e21719aeb
6 changed files with 24 additions and 29 deletions

View File

@ -29,6 +29,10 @@ module Risc
run_all "4 * 4"
assert_equal 16 , get_return.value
end
def test_smaller
run_all "4 < 5"
assert_equal 16 , get_return.value
end
end
end
end

View File

@ -11,19 +11,13 @@ module Risc
def test_chain
#show_main_ticks # get output of what is
check_main_chain [Label, LoadConstant, SlotToReg, RegToSlot, LoadConstant,
check_main_chain [Label, LoadConstant, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction,
IsZero, SlotToReg, SlotToReg, SlotToReg, LoadConstant,
RegToSlot, LoadConstant, LoadConstant, SlotToReg, SlotToReg,
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
SlotToReg, OperatorInstruction, IsZero, Label, RegToSlot,
Label, LoadConstant, SlotToReg, LoadConstant, SlotToReg,
RegToSlot, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
@ -53,16 +47,16 @@ module Risc
end
def test_dyn
cal = main_ticks(98)
cal = main_ticks(68)
assert_equal DynamicJump , cal.class
end
#should end in exit, but doesn't, becasue resolve never returns
def test_sys
sys = main_ticks(129)
sys = main_ticks(99)
assert_equal Syscall , sys.class
end
def test_return
ret = main_ticks(127)
ret = main_ticks(97)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal Label , link.class