2017-09-12 16:49:42 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Vool
|
|
|
|
class TestSendCachedSimpleMom < MiniTest::Test
|
|
|
|
include MomCompile
|
2018-03-16 14:11:17 +01:00
|
|
|
include Mom
|
2017-09-12 16:49:42 +02:00
|
|
|
|
|
|
|
def setup
|
|
|
|
Risc.machine.boot
|
2018-03-16 14:11:17 +01:00
|
|
|
@ins = compile_first_method_flat( "a = 5; a.mod4")
|
2017-12-05 20:46:37 +01:00
|
|
|
end
|
2017-09-14 17:42:01 +02:00
|
|
|
def test_if_first
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal IfStatement , @ins.class , @ins
|
2017-09-14 17:42:01 +02:00
|
|
|
end
|
|
|
|
def test_if_condition_set
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal NotSameCheck , @ins.condition.class , @ins
|
2017-09-14 17:42:01 +02:00
|
|
|
end
|
2018-03-10 14:17:36 +01:00
|
|
|
def test_if_true_moves_type
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal @ins.if_true[0].class, SlotLoad , @ins.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
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal @ins.if_true[1].class , MessageSetup, @ins.if_true.to_rxf
|
2018-03-10 14:31:38 +01:00
|
|
|
end
|
|
|
|
def test_if_true_resolves_transfer
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal @ins.if_true[2].class , ArgumentTransfer, @ins.if_true.to_rxf
|
2018-03-10 14:31:38 +01:00
|
|
|
end
|
|
|
|
def test_if_true_resolves_call
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal @ins.if_true[3].class , SimpleCall, @ins.if_true.to_rxf
|
2018-03-10 14:31:38 +01:00
|
|
|
end
|
|
|
|
def test_if_true_resolves_move
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal @ins.if_true[4].class , SlotLoad, @ins.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
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal MessageSetup , @ins.next.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
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal ArgumentTransfer , @ins.next(2).class , @third.to_rxf
|
2017-12-05 20:46:37 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_call_third
|
2018-03-16 15:09:35 +01:00
|
|
|
assert_equal DynamicCall , @ins.last.class , @fourth.to_rxf
|
2017-12-05 20:46:37 +01:00
|
|
|
end
|
|
|
|
|
2018-03-15 16:21:46 +01:00
|
|
|
def test_array
|
2018-03-16 14:11:17 +01:00
|
|
|
check_array [SlotLoad,NotSameCheck,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,DynamicCall] , @ins
|
2018-03-15 16:21:46 +01:00
|
|
|
end
|
|
|
|
|
2017-09-12 16:49:42 +02:00
|
|
|
end
|
|
|
|
end
|