2018-04-27 20:56:41 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Vool
|
2019-10-03 19:55:41 +02:00
|
|
|
class TestSendArgsSendSlotMachine < MiniTest::Test
|
2019-08-12 10:57:32 +02:00
|
|
|
include VoolCompile
|
2018-04-27 20:56:41 +02:00
|
|
|
|
|
|
|
def setup
|
2019-09-12 21:27:10 +02:00
|
|
|
@compiler = compile_main( "a = main(4.div4);return a" , "Integer.div4")
|
2019-10-03 19:55:41 +02:00
|
|
|
@ins = @compiler.slot_instructions.next
|
2018-04-27 20:56:41 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_array
|
|
|
|
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, MessageSetup ,
|
2019-08-17 22:29:42 +02:00
|
|
|
ArgumentTransfer, SimpleCall, SlotLoad ,SlotLoad, ReturnJump,
|
|
|
|
Label, ReturnSequence , Label] , @ins
|
2018-04-27 20:56:41 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_one_call
|
|
|
|
assert_equal SimpleCall, @ins.next(2).class
|
2019-09-12 21:27:10 +02:00
|
|
|
assert_equal :div4 , @ins.next(2).method.name
|
2018-04-27 20:56:41 +02:00
|
|
|
end
|
|
|
|
def test_two_call
|
|
|
|
assert_equal SimpleCall, @ins.next(6).class
|
|
|
|
assert_equal :main, @ins.next(6).method.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|