more test fixing

only one bug to go
This commit is contained in:
Torsten Ruger
2018-05-24 21:20:56 +03:00
parent bf23883270
commit 8d8cc4b016
27 changed files with 332 additions and 348 deletions

View File

@ -11,48 +11,50 @@ module Risc
def test_if
#show_main_ticks # get output of what is in main
check_main_chain [Label, LoadConstant, SlotToReg, RegToSlot, Label,
check_main_chain [LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
LoadConstant, OperatorInstruction, IsZero, LoadConstant, OperatorInstruction,
IsZero, LoadConstant, SlotToReg, RegToSlot, Branch,
SlotToReg, SlotToReg, LoadConstant, OperatorInstruction, IsZero,
LoadConstant, OperatorInstruction, IsZero, LoadConstant, SlotToReg,
RegToSlot, Branch, Label, SlotToReg, SlotToReg,
LoadConstant, OperatorInstruction, IsZero, Label, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, SlotToReg, FunctionReturn, Transfer, Syscall,
NilClass]
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, FunctionReturn, Transfer,
Syscall, NilClass]
assert_kind_of Parfait::FalseClass , get_return
end
def test_load_false_const
load = main_ticks(2)
load = main_ticks(1)
assert_equal LoadConstant , load.class
assert_kind_of Parfait::TrueClass , load.constant
end
def base
6
end
def test_load_false
load = main_ticks(8)
load = main_ticks(base)
assert_equal LoadConstant , load.class
assert_equal Parfait::FalseClass , load.constant.class
end
def test_compare
op = main_ticks(9)
op = main_ticks(base+1)
assert_equal OperatorInstruction , op.class
assert_equal :- , op.operator
end
def test_not_zero
check = main_ticks(10)
check = main_ticks(base + 2)
assert_equal IsZero , check.class
assert check.label.name.start_with?("merge_label") , check.label.name
end
def test_compare2
op = main_ticks(12)
op = main_ticks(base + 4)
assert_equal OperatorInstruction , op.class
assert_equal :- , op.operator
end
def test_not_zero2
check = main_ticks(13)
check = main_ticks(base + 5)
assert_equal IsZero , check.class
assert check.label.name.start_with?("merge_label") , check.label.name
end
def test_exit
done = main_ticks(35)
done = main_ticks(31)
assert_equal Syscall , done.class
end
end