fix all tests from removing the receiver load
This commit is contained in:
parent
48485477c2
commit
d9ce295b89
@ -7,8 +7,8 @@ module Risc
|
||||
def setup
|
||||
super
|
||||
@input = "r = 5.mod4"
|
||||
@expect = [Label, LoadConstant, SlotToReg, RegToSlot, Label, Label ,
|
||||
SlotToReg, SlotToReg, RegToSlot]
|
||||
@expect = [Label, LoadConstant, SlotToReg, RegToSlot, Label, SlotToReg ,
|
||||
SlotToReg, RegToSlot]
|
||||
end
|
||||
def test_local_assign_instructions
|
||||
assert_nil msg = check_nil , msg
|
||||
|
@ -51,7 +51,11 @@ module MomCompile
|
||||
res << is.class.name.split("::").last
|
||||
is = is.next
|
||||
end
|
||||
"[#{res.join(',')}]"
|
||||
ret = ""
|
||||
res.to_s.split(",").each_slice(6).each do |line|
|
||||
ret += " " + line.join(",") + " ,\n"
|
||||
end
|
||||
ret.gsub('"' , '')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -8,27 +8,27 @@ module Vool
|
||||
assert_equal Mom::MessageSetup , @ins.class , @ins
|
||||
end
|
||||
def test_two_instructions_are_returned
|
||||
assert_equal 4 , @ins.length , @ins
|
||||
assert_equal 3 , @ins.length , @ins
|
||||
end
|
||||
def test_receiver_move_class
|
||||
assert_equal Mom::ArgumentTransfer, @ins.next(2).class
|
||||
assert_equal Mom::ArgumentTransfer, @ins.next(1).class
|
||||
end
|
||||
def test_receiver_move
|
||||
assert_equal :receiver, @ins.next(1).left.slots[1]
|
||||
assert_equal Mom::SlotDefinition, @ins.next.receiver.class
|
||||
end
|
||||
def test_receiver
|
||||
type , value = receiver
|
||||
assert_equal type, @ins.next.right.known_object.class
|
||||
assert_equal value, @ins.next.right.known_object.value
|
||||
assert_equal type, @ins.next.receiver.known_object.class
|
||||
assert_equal value, @ins.next.receiver.known_object.value
|
||||
end
|
||||
def test_call_is
|
||||
assert_equal Mom::SimpleCall, @ins.next(3).class
|
||||
assert_equal Mom::SimpleCall, @ins.next(2).class
|
||||
end
|
||||
def test_call_has_method
|
||||
assert_equal Parfait::TypedMethod, @ins.next(3).method.class
|
||||
assert_equal Parfait::TypedMethod, @ins.next(2).method.class
|
||||
end
|
||||
def test_array
|
||||
check_array [Mom::MessageSetup,Mom::SlotLoad,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
|
||||
check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -19,14 +19,14 @@ module Vool
|
||||
assert_equal :type , load.right.slots[1] , load
|
||||
end
|
||||
def test_check_resolve_call
|
||||
assert_equal SimpleCall , @ins.next(6).class , @ins
|
||||
assert_equal SimpleCall , @ins.next(5).class , @ins
|
||||
end
|
||||
def test_dynamic_call_last
|
||||
assert_equal DynamicCall , @ins.last.class , @ins
|
||||
end
|
||||
|
||||
def test_array
|
||||
check_array [SlotLoad,NotSameCheck,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,DynamicCall] , @ins
|
||||
check_array [SlotLoad,NotSameCheck,SlotLoad,MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,MessageSetup,ArgumentTransfer,DynamicCall] , @ins
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -14,22 +14,20 @@ module Vool
|
||||
def setup
|
||||
do_setup("self.get_internal_word(0)")
|
||||
end
|
||||
|
||||
def test_receiver
|
||||
assert_equal SlotDefinition, @ins.next.right.class
|
||||
assert_equal SlotDefinition, @ins.next.receiver.class
|
||||
end
|
||||
|
||||
def test_arg_one
|
||||
assert_equal SlotLoad, @ins.next(2).arguments[0].class
|
||||
assert_equal SlotLoad, @ins.next(1).arguments[0].class
|
||||
end
|
||||
def test_call_two
|
||||
assert_equal SimpleCall, @ins.next(3).class
|
||||
assert_equal SimpleCall, @ins.next(2).class
|
||||
end
|
||||
def test_call_has_method
|
||||
assert_equal Parfait::TypedMethod, @ins.next(3).method.class
|
||||
assert_equal Parfait::TypedMethod, @ins.next(2).method.class
|
||||
end
|
||||
def test_call_has_right_method
|
||||
assert_equal :get_internal_word, @ins.next(3).method.name
|
||||
assert_equal :get_internal_word, @ins.next(2).method.name
|
||||
end
|
||||
end
|
||||
class TestSendSelfImplicitMom < TestSendSelfMom
|
||||
|
@ -14,7 +14,7 @@ module Vool
|
||||
[Mom::IntegerConstant , 5]
|
||||
end
|
||||
def test_call_has_right_method
|
||||
assert_equal :mod4, @ins.next(3).method.name
|
||||
assert_equal :mod4, @ins.next(2).method.name
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -15,15 +15,15 @@ module Vool
|
||||
[Mom::IntegerConstant , 5]
|
||||
end
|
||||
def test_args_two_move
|
||||
assert_equal :next_message, @ins.next(2).arguments[1].left.slots[0]
|
||||
assert_equal :arguments, @ins.next(2).arguments[1].left.slots[1]
|
||||
assert_equal :next_message, @ins.next(1).arguments[1].left.slots[0]
|
||||
assert_equal :arguments, @ins.next(1).arguments[1].left.slots[1]
|
||||
end
|
||||
def test_args_two_str
|
||||
assert_equal Mom::IntegerConstant, @ins.next(2).arguments[1].right.known_object.class
|
||||
assert_equal 2, @ins.next(2).arguments[1].right.known_object.value
|
||||
assert_equal Mom::IntegerConstant, @ins.next(1).arguments[1].right.known_object.class
|
||||
assert_equal 2, @ins.next(1).arguments[1].right.known_object.value
|
||||
end
|
||||
def test_array
|
||||
check_array [Mom::MessageSetup,Mom::SlotLoad,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
|
||||
check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -15,15 +15,12 @@ module Vool
|
||||
end
|
||||
|
||||
def test_args_one_move
|
||||
assert_equal :next_message, @ins.next.next.arguments[0].left.slots[0]
|
||||
assert_equal :arguments, @ins.next.next.arguments[0].left.slots[1]
|
||||
assert_equal :next_message, @ins.next.arguments[0].left.slots[0]
|
||||
assert_equal :arguments, @ins.next.arguments[0].left.slots[1]
|
||||
end
|
||||
def test_args_one_str
|
||||
assert_equal Mom::IntegerConstant, @ins.next.next.arguments[0].right.known_object.class
|
||||
assert_equal 1, @ins.next.next.arguments[0].right.known_object.value
|
||||
end
|
||||
def test_array
|
||||
check_array [Mom::MessageSetup,Mom::SlotLoad,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
|
||||
assert_equal Mom::IntegerConstant, @ins.next.arguments[0].right.known_object.class
|
||||
assert_equal 1, @ins.next.arguments[0].right.known_object.value
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,16 +12,19 @@ module Vool
|
||||
end
|
||||
|
||||
def test_condition
|
||||
assert_equal TruthCheck , @ins.next(12).class
|
||||
assert_equal TruthCheck , @ins.next(10).class
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal SlotDefinition , @ins.next(12).condition.class , @ins
|
||||
assert_equal SlotDefinition , @ins.next(10).condition.class , @ins
|
||||
end
|
||||
def test_hoisted_dynamic_call
|
||||
assert_equal DynamicCall , @ins.next(10).class
|
||||
assert_equal DynamicCall , @ins.next(8).class
|
||||
end
|
||||
def test_array
|
||||
check_array [NotSameCheck,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,DynamicCall,SlotLoad,TruthCheck,Label,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Jump,Label,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Label], @ins
|
||||
check_array [NotSameCheck, SlotLoad, MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad ,
|
||||
MessageSetup, ArgumentTransfer, DynamicCall, SlotLoad, TruthCheck, Label ,
|
||||
MessageSetup, ArgumentTransfer, SimpleCall, Jump, Label, MessageSetup ,
|
||||
ArgumentTransfer, SimpleCall, Label] , @ins
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ module Vool
|
||||
assert_equal Label , @ins.last.class , @ins
|
||||
end
|
||||
def test_array
|
||||
check_array [TruthCheck,Label,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Label], @ins
|
||||
check_array [TruthCheck,Label,MessageSetup,ArgumentTransfer,SimpleCall,Label], @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,8 @@ module Vool
|
||||
assert_equal Label , @ins.last.class , @ins
|
||||
end
|
||||
def test_array
|
||||
check_array [TruthCheck,Label,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Jump,Label,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Label], @ins
|
||||
check_array [TruthCheck, Label, MessageSetup, ArgumentTransfer, SimpleCall, Jump ,
|
||||
Label, MessageSetup, ArgumentTransfer, SimpleCall, Label] , @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -51,7 +51,7 @@ module Vool
|
||||
assert_equal ReturnSequence , @ins.last.class
|
||||
end
|
||||
def test_array
|
||||
check_array [MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,SlotLoad,ReturnSequence] , @ins
|
||||
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,SlotLoad,ReturnSequence] , @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,16 +12,16 @@ module Vool
|
||||
end
|
||||
|
||||
def test_condition_compiles_to_check
|
||||
assert_equal TruthCheck , @ins.next(6).class
|
||||
assert_equal TruthCheck , @ins.next(5).class
|
||||
end
|
||||
def test_condition_is_slot
|
||||
assert_equal SlotDefinition , @ins.next(6).condition.class , @ins
|
||||
assert_equal SlotDefinition , @ins.next(5).condition.class , @ins
|
||||
end
|
||||
def test_hoisetd
|
||||
assert_equal MessageSetup , @ins.class
|
||||
end
|
||||
def test_array
|
||||
check_array [MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,Label,TruthCheck,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Jump,Label] , @ins
|
||||
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,Label,TruthCheck,MessageSetup,ArgumentTransfer,SimpleCall,Jump,Label] , @ins
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ module Vool
|
||||
assert_equal SlotDefinition , @ins.next.condition.class , @ins
|
||||
end
|
||||
def test_array
|
||||
check_array [Label,TruthCheck,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Jump,Label] , @ins
|
||||
check_array [Label,TruthCheck,MessageSetup,ArgumentTransfer,SimpleCall,Jump,Label] , @ins
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user