2018-04-26 20:26:42 +03:00
|
|
|
require_relative "../helper"
|
|
|
|
|
2019-10-04 00:36:49 +03:00
|
|
|
module Sol
|
2018-03-15 21:54:03 +05:30
|
|
|
# relies on @ins and receiver_type method
|
2017-09-11 21:30:28 +03:00
|
|
|
module SimpleSendHarness
|
2019-10-04 00:36:49 +03:00
|
|
|
include SolCompile
|
2019-10-03 20:55:41 +03:00
|
|
|
include SlotMachine
|
2018-04-26 20:26:42 +03:00
|
|
|
|
|
|
|
def setup
|
2019-09-12 22:27:10 +03:00
|
|
|
@compiler = compile_main( send_method , "Integer.div4;Object.get")
|
2019-10-03 20:55:41 +03:00
|
|
|
@ins = @compiler.slot_instructions.next
|
2018-04-26 20:26:42 +03:00
|
|
|
end
|
|
|
|
|
2018-06-30 10:08:18 +03:00
|
|
|
def test_first_not_array
|
2018-03-15 21:54:03 +05:30
|
|
|
assert Array != @ins.class , @ins
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
def test_class_compiles
|
2019-08-12 11:57:32 +03:00
|
|
|
assert_equal MessageSetup , @ins.class , @ins
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
def test_two_instructions_are_returned
|
2019-08-17 23:29:42 +03:00
|
|
|
assert_equal 8 , @ins.length , @ins
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
def test_receiver_move_class
|
2019-08-12 11:57:32 +03:00
|
|
|
assert_equal ArgumentTransfer, @ins.next(1).class
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
def test_receiver
|
|
|
|
type , value = receiver
|
2018-03-20 23:31:42 +05:30
|
|
|
assert_equal type, @ins.next.receiver.known_object.class
|
|
|
|
assert_equal value, @ins.next.receiver.known_object.value
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
def test_call_is
|
2019-08-12 11:57:32 +03:00
|
|
|
assert_equal SimpleCall, @ins.next(2).class
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
def test_call_has_method
|
2018-07-07 09:11:09 +03:00
|
|
|
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
2018-03-16 18:41:17 +05:30
|
|
|
def test_array
|
2019-08-17 23:29:42 +03:00
|
|
|
check_array [MessageSetup,ArgumentTransfer,SimpleCall,
|
|
|
|
SlotLoad, ReturnJump, Label, ReturnSequence ,
|
2019-08-12 11:57:32 +03:00
|
|
|
Label] , @ins
|
2018-03-16 18:41:17 +05:30
|
|
|
end
|
2017-09-11 21:30:28 +03:00
|
|
|
end
|
|
|
|
end
|