store method, not name, in message
changes the calling and thus too many test
This commit is contained in:
@ -9,13 +9,13 @@ module Risc
|
||||
@input = "while(5 > 0) ; @a = true; end"
|
||||
@expect = [Label, LoadConstant, LoadConstant, SlotToReg, RegToSlot,
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant,
|
||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
||||
RegToSlot, SlotToReg, FunctionCall, Label, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, LoadConstant,
|
||||
OperatorInstruction, IsZero, LoadConstant, OperatorInstruction, IsZero,
|
||||
LoadConstant, SlotToReg, RegToSlot, Branch, Label]
|
||||
SlotToReg, RegToSlot, RegToSlot, SlotToReg, RegToSlot,
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
|
||||
SlotToReg, FunctionCall, Label, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, LoadConstant, OperatorInstruction,
|
||||
IsZero, LoadConstant, OperatorInstruction, IsZero, LoadConstant,
|
||||
SlotToReg, RegToSlot, Branch, Label]
|
||||
end
|
||||
|
||||
def test_while_instructions
|
||||
@ -26,33 +26,33 @@ module Risc
|
||||
end
|
||||
def test_int_load_5
|
||||
produced = produce_body
|
||||
load = produced.next(16)
|
||||
load = produced.next(15)
|
||||
assert_equal Risc::LoadConstant , load.class
|
||||
assert_equal Parfait::Integer , load.constant.class
|
||||
assert_equal 5 , load.constant.value
|
||||
end
|
||||
def test_int_load_0
|
||||
produced = produce_body
|
||||
load = produced.next(19)
|
||||
load = produced.next(18)
|
||||
assert_equal Risc::LoadConstant , load.class
|
||||
assert_equal Parfait::Integer , load.constant.class
|
||||
assert_equal 0 , load.constant.value
|
||||
end
|
||||
def test_false_check
|
||||
produced = produce_body
|
||||
assert_equal Risc::IsZero , produced.next(36).class
|
||||
assert produced.next(36).label.name.start_with?("merge_label") , produced.next(36).label.name
|
||||
assert_equal Risc::IsZero , produced.next(35).class
|
||||
assert produced.next(35).label.name.start_with?("merge_label") , produced.next(35).label.name
|
||||
end
|
||||
def test_nil_load
|
||||
produced = produce_body
|
||||
assert_equal Risc::LoadConstant , produced.next(37).class
|
||||
assert_equal Parfait::NilClass , produced.next(37).constant.class
|
||||
assert_equal Risc::LoadConstant , produced.next(36).class
|
||||
assert_equal Parfait::NilClass , produced.next(36).constant.class
|
||||
end
|
||||
|
||||
def test_back_jump # should jump back to condition label
|
||||
produced = produce_body
|
||||
assert_equal Risc::Branch , produced.next(43).class
|
||||
assert_equal produced , produced.next(43).label
|
||||
assert_equal Risc::Branch , produced.next(42).class
|
||||
assert_equal produced , produced.next(42).label
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user