diff --git a/test/mom/assign/test_assign_local_send.rb b/test/mom/assign/test_assign_local_send.rb index 77a48449..ce29db55 100644 --- a/test/mom/assign/test_assign_local_send.rb +++ b/test/mom/assign/test_assign_local_send.rb @@ -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 diff --git a/test/support/compiling.rb b/test/support/compiling.rb index 78a55c49..98c64473 100644 --- a/test/support/compiling.rb +++ b/test/support/compiling.rb @@ -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 diff --git a/test/vool/to_mom/send/simple_send_harness.rb b/test/vool/to_mom/send/simple_send_harness.rb index 051a8722..61540012 100644 --- a/test/vool/to_mom/send/simple_send_harness.rb +++ b/test/vool/to_mom/send/simple_send_harness.rb @@ -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 diff --git a/test/vool/to_mom/send/test_send_cached_simple.rb b/test/vool/to_mom/send/test_send_cached_simple.rb index 54c9923f..f841b7e2 100644 --- a/test/vool/to_mom/send/test_send_cached_simple.rb +++ b/test/vool/to_mom/send/test_send_cached_simple.rb @@ -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 diff --git a/test/vool/to_mom/send/test_send_self.rb b/test/vool/to_mom/send/test_send_self.rb index cffa3959..0ec8614b 100644 --- a/test/vool/to_mom/send/test_send_self.rb +++ b/test/vool/to_mom/send/test_send_self.rb @@ -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 diff --git a/test/vool/to_mom/send/test_send_simple.rb b/test/vool/to_mom/send/test_send_simple.rb index 12672a2c..d35a8068 100644 --- a/test/vool/to_mom/send/test_send_simple.rb +++ b/test/vool/to_mom/send/test_send_simple.rb @@ -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 diff --git a/test/vool/to_mom/send/test_send_simple_args.rb b/test/vool/to_mom/send/test_send_simple_args.rb index 49c23dcc..e4e7a5f8 100644 --- a/test/vool/to_mom/send/test_send_simple_args.rb +++ b/test/vool/to_mom/send/test_send_simple_args.rb @@ -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 diff --git a/test/vool/to_mom/send/test_send_simple_string.rb b/test/vool/to_mom/send/test_send_simple_string.rb index ccd237b1..124480b4 100644 --- a/test/vool/to_mom/send/test_send_simple_string.rb +++ b/test/vool/to_mom/send/test_send_simple_string.rb @@ -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 diff --git a/test/vool/to_mom/test_if_condition.rb b/test/vool/to_mom/test_if_condition.rb index e3ed295b..47fb6dca 100644 --- a/test/vool/to_mom/test_if_condition.rb +++ b/test/vool/to_mom/test_if_condition.rb @@ -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 diff --git a/test/vool/to_mom/test_if_no_else.rb b/test/vool/to_mom/test_if_no_else.rb index 36c0f094..22b7b063 100644 --- a/test/vool/to_mom/test_if_no_else.rb +++ b/test/vool/to_mom/test_if_no_else.rb @@ -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 diff --git a/test/vool/to_mom/test_if_simple.rb b/test/vool/to_mom/test_if_simple.rb index 87273139..b05b35f3 100644 --- a/test/vool/to_mom/test_if_simple.rb +++ b/test/vool/to_mom/test_if_simple.rb @@ -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 diff --git a/test/vool/to_mom/test_return.rb b/test/vool/to_mom/test_return.rb index 4005ed51..a16e0c51 100644 --- a/test/vool/to_mom/test_return.rb +++ b/test/vool/to_mom/test_return.rb @@ -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 diff --git a/test/vool/to_mom/test_while_condition.rb b/test/vool/to_mom/test_while_condition.rb index 0ed7e0f5..fc0c8225 100644 --- a/test/vool/to_mom/test_while_condition.rb +++ b/test/vool/to_mom/test_while_condition.rb @@ -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 diff --git a/test/vool/to_mom/test_while_simple.rb b/test/vool/to_mom/test_while_simple.rb index b02787a0..cb0c481b 100644 --- a/test/vool/to_mom/test_while_simple.rb +++ b/test/vool/to_mom/test_while_simple.rb @@ -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