2018-04-26 19:26:42 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
2017-09-11 20:30:28 +02:00
|
|
|
module Vool
|
2018-03-15 17:24:03 +01:00
|
|
|
# relies on @ins and receiver_type method
|
2017-09-11 20:30:28 +02:00
|
|
|
module SimpleSendHarness
|
2019-08-07 14:08:45 +02:00
|
|
|
include VoolCompile
|
2018-04-26 19:26:42 +02:00
|
|
|
|
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-06-29 23:39:23 +02:00
|
|
|
Risc::Builtin.boot_functions
|
2018-04-26 19:26:42 +02:00
|
|
|
@ins = compile_first_method( send_method )
|
|
|
|
end
|
|
|
|
|
2018-06-30 09:08:18 +02:00
|
|
|
def test_first_not_array
|
2018-03-15 17:24:03 +01:00
|
|
|
assert Array != @ins.class , @ins
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_class_compiles
|
2018-03-15 17:24:03 +01:00
|
|
|
assert_equal Mom::MessageSetup , @ins.class , @ins
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_two_instructions_are_returned
|
2018-03-20 19:01:42 +01:00
|
|
|
assert_equal 3 , @ins.length , @ins
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_receiver_move_class
|
2018-03-20 19:01:42 +01:00
|
|
|
assert_equal Mom::ArgumentTransfer, @ins.next(1).class
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_receiver_move
|
2018-03-20 19:01:42 +01:00
|
|
|
assert_equal Mom::SlotDefinition, @ins.next.receiver.class
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_receiver
|
|
|
|
type , value = receiver
|
2018-03-20 19:01:42 +01:00
|
|
|
assert_equal type, @ins.next.receiver.known_object.class
|
|
|
|
assert_equal value, @ins.next.receiver.known_object.value
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_call_is
|
2018-03-20 19:01:42 +01:00
|
|
|
assert_equal Mom::SimpleCall, @ins.next(2).class
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
def test_call_has_method
|
2018-07-07 08:11:09 +02:00
|
|
|
assert_equal Parfait::CallableMethod, @ins.next(2).method.class
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
2018-03-16 14:11:17 +01:00
|
|
|
def test_array
|
2018-03-20 19:01:42 +01:00
|
|
|
check_array [Mom::MessageSetup,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins
|
2018-03-16 14:11:17 +01:00
|
|
|
end
|
2017-09-11 20:30:28 +02:00
|
|
|
end
|
|
|
|
end
|