fix mom and vool after cc changes
This commit is contained in:
@ -7,9 +7,7 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "local = arg; return local"
|
||||
@expect =[ SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #4
|
||||
RegToSlot, Branch] #9
|
||||
|
||||
@expect = [SlotToReg, RegToSlot, SlotToReg, RegToSlot, Branch] #4
|
||||
end
|
||||
def test_local_assign_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
@ -26,8 +24,8 @@ module Risc
|
||||
end
|
||||
def test_load_frame_from_message
|
||||
produced = produce_body
|
||||
assert_equal :r3 , produced.next(2).array.symbol , produced.next.to_rxf[0..200]
|
||||
assert_equal 3 , produced.next.index , produced.next.to_rxf[0..200]
|
||||
assert_equal 16 , produced.next.index , produced.next.to_rxf[0..200]
|
||||
assert_equal :r0 , produced.next(2).array.symbol
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "r = false;return"
|
||||
@expect = [LoadConstant,SlotToReg, RegToSlot,LoadConstant, RegToSlot, Branch]
|
||||
@expect = [LoadConstant, RegToSlot,LoadConstant, RegToSlot, Branch]
|
||||
end
|
||||
def test_local_assign_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
@ -21,12 +21,12 @@ module Risc
|
||||
def test_frame_load
|
||||
produced = produce_body
|
||||
assert_equal :Message , produced.next(1).array.type.class_name
|
||||
assert_equal 3 , produced.next(1).index # 3 is frame
|
||||
assert_equal 16 , produced.next(1).index # 3 is frame
|
||||
end
|
||||
def test_value_load
|
||||
produced = produce_body
|
||||
assert_equal produced.next(2).register , produced.register
|
||||
assert_equal 1 , produced.next(2).index #type == 0 , r == 1
|
||||
assert_equal 16 , produced.next(1).index #type == 0 , r == 16
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,7 +7,7 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "r = 5;return"
|
||||
@expect = [LoadConstant,SlotToReg, RegToSlot, LoadConstant, RegToSlot, Branch]
|
||||
@expect = [LoadConstant, RegToSlot, LoadConstant, RegToSlot, Branch]
|
||||
end
|
||||
def test_local_assign_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
@ -21,12 +21,11 @@ module Risc
|
||||
def test_frame_load
|
||||
produced = produce_body
|
||||
assert_equal :Message , produced.next(1).array.type.class_name
|
||||
assert_equal 3 , produced.next(1).index # 4 is frame
|
||||
assert_equal 16 , produced.next(1).index # 4 is frame
|
||||
end
|
||||
def test_value_load
|
||||
produced = produce_body
|
||||
assert_equal produced.next(2).register , produced.register
|
||||
assert_equal 1 , produced.next(2).index #type == 1 , r == 2
|
||||
assert_equal produced.next(1).register , produced.register
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,8 +7,8 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "@ivar = 5 ; r = @ivar;return"
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg ,
|
||||
RegToSlot, LoadConstant, RegToSlot, Branch]
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #4
|
||||
RegToSlot, LoadConstant, RegToSlot, Branch] #9
|
||||
end
|
||||
def test_local_assign_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
|
@ -7,11 +7,11 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "r = 5.div4;return"
|
||||
@expect = [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg,
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
|
||||
FunctionCall, Label, SlotToReg, SlotToReg, RegToSlot,
|
||||
LoadConstant, RegToSlot, Branch]
|
||||
@expect = [LoadConstant, LoadConstant, SlotToReg, SlotToReg, RegToSlot, #4
|
||||
RegToSlot, RegToSlot, RegToSlot, LoadConstant, SlotToReg, #9
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #14
|
||||
FunctionCall, Label, SlotToReg, RegToSlot, LoadConstant, #19
|
||||
RegToSlot, Branch] #2
|
||||
end
|
||||
def test_local_assign_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
|
@ -7,7 +7,7 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = as_block("a = 5")
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot]
|
||||
@expect = [LoadConstant, RegToSlot]
|
||||
end
|
||||
def test_send_instructions
|
||||
assert_nil msg = check_nil(:main_block) , msg
|
||||
|
@ -7,11 +7,11 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = as_block("return 5")
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, LoadConstant, #4
|
||||
SlotToReg, SlotToReg, RegToSlot, RegToSlot, RegToSlot, #9
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, LoadConstant, #14
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #19
|
||||
SlotToReg, FunctionCall, Label] #24
|
||||
@expect = [LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg, #4
|
||||
SlotToReg, RegToSlot, RegToSlot, RegToSlot, RegToSlot, #9
|
||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #14
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #19
|
||||
FunctionCall, Label] #24
|
||||
end
|
||||
|
||||
def test_send_instructions
|
||||
@ -28,12 +28,12 @@ module Risc
|
||||
assert_equal 5 , produced.constant.value
|
||||
end
|
||||
def test_load_next_message
|
||||
produced = produce_body.next(4)
|
||||
produced = produce_body.next(3)
|
||||
assert_load( produced , Parfait::Factory)
|
||||
assert_equal "Message_Type" , produced.constant.for_type.name
|
||||
end
|
||||
def test_load_block
|
||||
produced = produce_body.next(14)
|
||||
produced = produce_body.next(13)
|
||||
assert_load( produced , Parfait::Block)
|
||||
assert_equal :main_block , produced.constant.name
|
||||
end
|
||||
@ -43,12 +43,12 @@ module Risc
|
||||
assert produced.constant.name.start_with?("continue_")
|
||||
end
|
||||
def test_function_call
|
||||
produced = produce_body.next(21)
|
||||
produced = produce_body.next(20)
|
||||
assert_equal FunctionCall , produced.class
|
||||
assert_equal :main , produced.method.name
|
||||
end
|
||||
def test_check_continue
|
||||
produced = produce_body.next(23)
|
||||
produced = produce_body.next(22)
|
||||
assert_equal Label , produced.class
|
||||
# assert produced.name.start_with?("continue_") , produced.name
|
||||
end
|
||||
|
Reference in New Issue
Block a user