add reduce_int and fix bug

hardcoded operator, buh
reduce_int to avoid that long constant
This commit is contained in:
Torsten Ruger
2018-08-08 15:49:07 +03:00
parent f5ea51c4d0
commit 78466090b3
3 changed files with 14 additions and 1 deletions

View File

@ -57,6 +57,7 @@ module Risc
assert_equal OperatorInstruction , ret.class
assert_equal @r0 , ret.left
assert_equal @r1 , ret.right
assert_equal :<< , ret.operator
end
def test_slot_to_reg
instr = @r0 << @r1[:next_message]

View File

@ -16,6 +16,11 @@ module Risc
def test_resolves_index_fail
assert_raises {@r0.resolve_index(:something)}
end
def test_reduce_int
ins = @r0.reduce_int
assert_equal SlotToReg , ins.class
assert_equal Parfait::Integer.integer_index , ins.index
end
def test_get_new_left_0
assert_equal RegisterValue , @r0.get_new_left(:caller , @compiler).class
end