2017-09-12 16:49:42 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Vool
|
|
|
|
class TestSendCachedSimpleMom < MiniTest::Test
|
|
|
|
include MomCompile
|
|
|
|
|
|
|
|
def setup
|
|
|
|
Risc.machine.boot
|
|
|
|
@stats = compile_first_method( "arg.mod4").first
|
2017-12-05 20:46:37 +01:00
|
|
|
@first, @second , @third ,@fourth= @stats[0],@stats[1],@stats[2],@stats[3]
|
2017-09-12 16:49:42 +02:00
|
|
|
end
|
|
|
|
|
2017-09-14 15:07:02 +02:00
|
|
|
def test_compiles_not_array
|
2017-09-12 16:49:42 +02:00
|
|
|
assert Array != @stats.class , @stats
|
|
|
|
end
|
2017-12-05 20:46:37 +01:00
|
|
|
def test_four_instructions_are_returned
|
|
|
|
assert_equal 4 , @stats.length
|
|
|
|
end
|
2017-09-14 17:42:01 +02:00
|
|
|
def test_if_first
|
|
|
|
assert_equal Mom::IfStatement , @first.class , @first
|
|
|
|
end
|
|
|
|
def test_if_condition_set
|
|
|
|
assert_equal Mom::NotSameCheck , @first.condition.class , @first
|
|
|
|
end
|
2018-03-10 14:17:36 +01:00
|
|
|
def test_if_true_moves_type
|
2018-03-10 14:31:38 +01:00
|
|
|
assert_equal @first.if_true[0].class, Mom::SlotMove , @first.if_true.to_rxf
|
2017-09-12 16:49:42 +02:00
|
|
|
end
|
2018-03-10 14:31:38 +01:00
|
|
|
def test_if_true_resolves_setup
|
|
|
|
assert_equal @first.if_true[1].class , Mom::MessageSetup, @first.if_true.to_rxf
|
|
|
|
end
|
|
|
|
def test_if_true_resolves_transfer
|
|
|
|
assert_equal @first.if_true[2].class , Mom::ArgumentTransfer, @first.if_true.to_rxf
|
|
|
|
end
|
|
|
|
def test_if_true_resolves_call
|
|
|
|
assert_equal @first.if_true[3].class , Mom::SimpleCall, @first.if_true.to_rxf
|
|
|
|
end
|
|
|
|
def test_if_true_resolves_move
|
|
|
|
assert_equal @first.if_true[4].class , Mom::SlotMove, @first.if_true.to_rxf
|
2017-09-12 16:49:42 +02:00
|
|
|
end
|
2018-03-10 14:17:36 +01:00
|
|
|
|
2017-12-05 20:46:37 +01:00
|
|
|
def test_setup_second
|
|
|
|
assert_equal Mom::MessageSetup , @second.class , @second.to_rxf
|
2017-09-12 16:49:42 +02:00
|
|
|
end
|
2017-12-05 20:46:37 +01:00
|
|
|
|
|
|
|
def test_transfer_third
|
|
|
|
assert_equal Mom::ArgumentTransfer , @third.class , @third.to_rxf
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_call_third
|
|
|
|
assert_equal Mom::DynamicCall , @fourth.class , @fourth.to_rxf
|
|
|
|
end
|
|
|
|
|
2017-09-12 16:49:42 +02:00
|
|
|
end
|
|
|
|
end
|