rubyx/test/vool/to_mom/send/test_send_cached_simple.rb

52 lines
1.5 KiB
Ruby
Raw Normal View History

require_relative "../helper"
module Vool
class TestSendCachedSimpleMom < MiniTest::Test
include MomCompile
2018-03-16 14:11:17 +01:00
include Mom
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 14:11:17 +01:00
assert_equal Mom::IfStatement , @ins.class , @ins
2017-09-14 17:42:01 +02:00
end
def test_if_condition_set
2018-03-16 14:11:17 +01:00
assert_equal Mom::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 14:11:17 +01:00
assert_equal @ins.if_true[0].class, Mom::SlotLoad , @ins.if_true.to_rxf
end
def test_if_true_resolves_setup
2018-03-16 14:11:17 +01:00
assert_equal @ins.if_true[1].class , Mom::MessageSetup, @ins.if_true.to_rxf
end
def test_if_true_resolves_transfer
2018-03-16 14:11:17 +01:00
assert_equal @ins.if_true[2].class , Mom::ArgumentTransfer, @ins.if_true.to_rxf
end
def test_if_true_resolves_call
2018-03-16 14:11:17 +01:00
assert_equal @ins.if_true[3].class , Mom::SimpleCall, @ins.if_true.to_rxf
end
def test_if_true_resolves_move
2018-03-16 14:11:17 +01:00
assert_equal @ins.if_true[4].class , Mom::SlotLoad, @ins.if_true.to_rxf
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
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
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
end
end