diff --git a/test/slot_machine/instructions/test_simple_call.rb b/test/slot_machine/instructions/test_simple_call.rb index 0f57b8f0..199e7634 100644 --- a/test/slot_machine/instructions/test_simple_call.rb +++ b/test/slot_machine/instructions/test_simple_call.rb @@ -24,8 +24,7 @@ module SlotMachine assert_slot_to_reg 4 ,:message , 1 , :message end def test_5_call - assert_equal Risc::FunctionCall , risc(5).class - assert_equal :meth , risc(5).method.name + assert_function_call 5 , :meth end def test_6_label assert_label 6 , "after_meth_" diff --git a/test/slot_machine/macro/test_init.rb b/test/slot_machine/macro/test_init.rb index 7a729ee6..d3aacf09 100644 --- a/test/slot_machine/macro/test_init.rb +++ b/test/slot_machine/macro/test_init.rb @@ -31,8 +31,7 @@ module SlotMachine assert_reg_to_slot 10 , "id_space_" , :message , 2 assert_load 11 , Risc::Label , "id_label_" assert_reg_to_slot 12 , "id_label_" , :message , 4 - assert_equal Risc::FunctionCall, risc(13).class - assert_equal :main, risc(13).method.name + assert_function_call 13 , :main assert_label 14 , "Object.__init__" assert_transfer 15 , :message , :saved_message assert_slot_to_reg 16 ,:message , 5 , :message diff --git a/test/support/risc_assert.rb b/test/support/risc_assert.rb index cbf6a51c..ca5b4347 100644 --- a/test/support/risc_assert.rb +++ b/test/support/risc_assert.rb @@ -124,6 +124,12 @@ module Minitest assert_equal Risc::Syscall , ins.class, "Class at:#{ins_i}" assert_equal ins.name , name end + def assert_function_call ins_i , name + assert_equal Integer , ins_i.class, "assert_function_call #{ins_i}" + ins = risc(ins_i) + assert_equal Risc::FunctionCall , ins.class, "Class at:#{ins_i}" + assert_equal name, ins.method.name , "Method name at #{ins_i}" + end def assert_minus ins_i , label assert_equal Integer , ins_i.class, "assert_minus #{ins_i}" ins = risc(ins_i) @@ -164,8 +170,7 @@ module Minitest assert_slot_to_reg 14 , :message , 1 , "message.next_message" assert_reg_to_slot 15 , "id_label" , "message.next_message" , 4 assert_slot_to_reg 16 ,:message , 1 , :message - assert_equal Risc::FunctionCall, risc(17).class - assert_equal :main, risc(17).method.name + assert_function_call 17 , :main assert_label 18 , "after_main_" assert_label 19 , "cont_label" assert_slot_to_reg 20 , "id_factory_.next_object" , 1 , "id_factory_.next_object.next_integer"