2017-04-16 10:39:21 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Vool
|
2017-04-23 16:50:06 +02:00
|
|
|
class TestSendSimpleMom < MiniTest::Test
|
2017-04-16 10:39:21 +02:00
|
|
|
include MomCompile
|
|
|
|
|
|
|
|
def setup
|
|
|
|
Risc.machine.boot
|
|
|
|
@stats = compile_first_method( "5.mod4").first
|
2017-09-10 12:14:51 +02:00
|
|
|
@first = @stats.first
|
2017-04-16 10:39:21 +02:00
|
|
|
end
|
|
|
|
|
2017-09-07 07:17:13 +02:00
|
|
|
def test_compiles_not_array
|
|
|
|
assert Array != @stats.class , @stats
|
|
|
|
end
|
2017-04-16 10:39:21 +02:00
|
|
|
def test_class_compiles
|
2017-09-10 12:14:51 +02:00
|
|
|
assert_equal Mom::SlotConstant , @first.class , @stats
|
2017-04-16 10:39:21 +02:00
|
|
|
end
|
|
|
|
def test_slot_is_set
|
|
|
|
assert @stats.first.left
|
|
|
|
end
|
|
|
|
def test_two_instructions_are_returned
|
|
|
|
assert_equal 2 , @stats.length
|
|
|
|
end
|
2017-04-19 19:59:13 +02:00
|
|
|
def test_receiver_move_class
|
2017-09-10 12:14:51 +02:00
|
|
|
assert_equal Mom::SlotConstant, @first.class
|
2017-04-16 10:39:21 +02:00
|
|
|
end
|
|
|
|
def test_receiver_move
|
2017-09-10 12:14:51 +02:00
|
|
|
assert_equal :receiver, @first.left[2]
|
2017-04-16 10:39:21 +02:00
|
|
|
end
|
2017-04-19 19:59:13 +02:00
|
|
|
def test_receiver
|
2017-09-10 12:14:51 +02:00
|
|
|
assert_equal IntegerStatement, @first.right.class
|
2017-04-19 19:59:13 +02:00
|
|
|
assert_equal 5, @stats.first.right.value
|
|
|
|
end
|
2017-04-16 10:39:21 +02:00
|
|
|
def test_call_is
|
|
|
|
assert_equal Mom::SimpleCall, @stats[1].class
|
|
|
|
end
|
|
|
|
def test_call_has_method
|
|
|
|
assert_equal Parfait::TypedMethod, @stats[1].method.class
|
|
|
|
end
|
|
|
|
def test_call_has_right_method
|
|
|
|
assert_equal :mod4, @stats[1].method.name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|