finally did assert_function_call

for cleaner reading, like all other instruction asserts
This commit is contained in:
Torsten 2020-03-10 17:27:13 +02:00
parent cf5a3c0102
commit ede103e73d
3 changed files with 9 additions and 6 deletions

View File

@ -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_"

View File

@ -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

View File

@ -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"