fix all mom tests
still quite brittle, but easy to fix
This commit is contained in:
@ -7,17 +7,18 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "@a.div4"
|
||||
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #4
|
||||
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg, #9
|
||||
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg, #14
|
||||
SlotToReg, Label, LoadConstant, OperatorInstruction, IsZero, #19
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch, #24
|
||||
Label, LoadConstant, SlotToReg, Transfer, Syscall, #29
|
||||
Transfer, Transfer, SlotToReg, RegToSlot, Label, #34
|
||||
RegToSlot, Label, LoadConstant, SlotToReg, RegToSlot, #39
|
||||
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant, #44
|
||||
SlotToReg, RegToSlot, SlotToReg, LoadConstant, SlotToReg, #49
|
||||
DynamicJump, Label, SlotToReg, RegToSlot, Branch,] #54
|
||||
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg, #5
|
||||
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg, #10
|
||||
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg, #15
|
||||
SlotToReg, Label, LoadConstant, OperatorInstruction, IsZero, #20
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch, #25
|
||||
Label, LoadConstant, SlotToReg, Transfer, Syscall, #30
|
||||
Transfer, Transfer, SlotToReg, RegToSlot, Label, #35
|
||||
RegToSlot, Label, LoadConstant, SlotToReg, SlotToReg, #40
|
||||
RegToSlot, SlotToReg, SlotToReg, SlotToReg, RegToSlot, #45
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant, #50
|
||||
SlotToReg, DynamicJump, Label, SlotToReg, RegToSlot, #55
|
||||
Branch,] #60
|
||||
end
|
||||
|
||||
def test_send_instructions
|
||||
@ -35,7 +36,7 @@ module Risc
|
||||
end
|
||||
def test_function_call
|
||||
produced = produce_body
|
||||
assert_equal DynamicJump , produced.next(50).class
|
||||
assert_equal DynamicJump , produced.next(51).class
|
||||
end
|
||||
def test_cache_check
|
||||
produced = produce_body
|
||||
|
@ -7,30 +7,30 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "5.div4"
|
||||
@expect = [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #4
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall, #9
|
||||
Label, SlotToReg, RegToSlot, Branch,] #14
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10
|
||||
FunctionCall, Label, SlotToReg, RegToSlot, Branch,] #15
|
||||
end
|
||||
|
||||
def test_send_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
end
|
||||
def test_load_5
|
||||
produced = produce_body.next(2)
|
||||
produced = produce_body.next(3)
|
||||
assert_load( produced , Parfait::Integer)
|
||||
assert_equal 5 , produced.constant.value
|
||||
end
|
||||
def test_load_label
|
||||
produced = produce_body.next(5)
|
||||
produced = produce_body.next(6)
|
||||
assert_load( produced , Label)
|
||||
end
|
||||
def test_function_call
|
||||
produced = produce_body.next(9)
|
||||
produced = produce_body.next(10)
|
||||
assert_equal FunctionCall , produced.class
|
||||
assert_equal :div4 , produced.method.name
|
||||
end
|
||||
def test_check_continue
|
||||
produced = produce_body.next(10)
|
||||
produced = produce_body.next(11)
|
||||
assert_equal Label , produced.class
|
||||
assert produced.name.start_with?("continue_")
|
||||
end
|
||||
|
@ -7,10 +7,10 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "5.get_internal_word(1)"
|
||||
@expect = [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #4
|
||||
LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #9
|
||||
RegToSlot, SlotToReg, FunctionCall, Label, SlotToReg, #14
|
||||
RegToSlot, Branch,] #19
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, LoadConstant, #10
|
||||
SlotToReg, RegToSlot, SlotToReg, FunctionCall, Label, #15
|
||||
SlotToReg, RegToSlot, Branch,] #20
|
||||
end
|
||||
|
||||
def test_send_instructions
|
||||
@ -18,11 +18,11 @@ module Risc
|
||||
end
|
||||
def test_load_5
|
||||
produced = produce_body
|
||||
assert_equal LoadConstant , produced.next(2).class
|
||||
assert_equal 5 , produced.next(2).constant.value
|
||||
assert_equal LoadConstant , produced.next(3).class
|
||||
assert_equal 5 , produced.next(3).constant.value
|
||||
end
|
||||
def base
|
||||
5
|
||||
6
|
||||
end
|
||||
def test_load_arg_const
|
||||
produced = produce_body
|
||||
|
@ -7,9 +7,9 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "return 5.div4"
|
||||
@expect = [LoadConstant, RegToSlot, LoadConstant, SlotToReg, RegToSlot, #4
|
||||
LoadConstant, SlotToReg, RegToSlot, SlotToReg, FunctionCall, #9
|
||||
Label, SlotToReg, RegToSlot, Branch] #14
|
||||
@expect = [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10
|
||||
FunctionCall, Label, SlotToReg, RegToSlot, Branch,] #15
|
||||
@produced = produce_body
|
||||
end
|
||||
|
||||
@ -22,7 +22,7 @@ module Risc
|
||||
assert_equal :div4 , method.constant.name
|
||||
end
|
||||
def test_store_method_in_message
|
||||
sl = @produced.next( 1 )
|
||||
sl = @produced.next( 2 )
|
||||
assert_reg_to_slot( sl , :r1 , :r2 , 7 )
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user