simple sends and all whiles working
This commit is contained in:
@ -3,39 +3,32 @@ require_relative "../helper"
|
||||
module Vool
|
||||
class TestSendCachedSimpleMom < MiniTest::Test
|
||||
include MomCompile
|
||||
include Mom
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@stats = compile_first_method_flat( "a = 5; a.mod4")
|
||||
@first, @second , @third ,@fourth= @stats[0],@stats[1],@stats[2],@stats[3]
|
||||
end
|
||||
|
||||
def test_compiles_not_array
|
||||
assert Array != @stats.class , @stats
|
||||
end
|
||||
def test_four_instructions_are_returned
|
||||
assert_equal 4 , @stats.length
|
||||
@ins = compile_first_method_flat( "a = 5; a.mod4")
|
||||
end
|
||||
def test_if_first
|
||||
assert_equal Mom::IfStatement , @first.class , @first
|
||||
assert_equal Mom::IfStatement , @ins.class , @ins
|
||||
end
|
||||
def test_if_condition_set
|
||||
assert_equal Mom::NotSameCheck , @first.condition.class , @first
|
||||
assert_equal Mom::NotSameCheck , @ins.condition.class , @ins
|
||||
end
|
||||
def test_if_true_moves_type
|
||||
assert_equal @first.if_true[0].class, Mom::SlotLoad , @first.if_true.to_rxf
|
||||
assert_equal @ins.if_true[0].class, Mom::SlotLoad , @ins.if_true.to_rxf
|
||||
end
|
||||
def test_if_true_resolves_setup
|
||||
assert_equal @first.if_true[1].class , Mom::MessageSetup, @first.if_true.to_rxf
|
||||
assert_equal @ins.if_true[1].class , Mom::MessageSetup, @ins.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
|
||||
assert_equal @ins.if_true[2].class , Mom::ArgumentTransfer, @ins.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
|
||||
assert_equal @ins.if_true[3].class , Mom::SimpleCall, @ins.if_true.to_rxf
|
||||
end
|
||||
def test_if_true_resolves_move
|
||||
assert_equal @first.if_true[4].class , Mom::SlotLoad, @first.if_true.to_rxf
|
||||
assert_equal @ins.if_true[4].class , Mom::SlotLoad, @ins.if_true.to_rxf
|
||||
end
|
||||
|
||||
def test_setup_second
|
||||
@ -51,7 +44,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_array
|
||||
check_array [SlotLoad,NotSameCheck,Label,SlotLoad,MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,Label,MessageSetup,ArgumentTransfer,DynamicCall] , @stats
|
||||
check_array [SlotLoad,NotSameCheck,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,MessageSetup,SlotLoad,ArgumentTransfer,DynamicCall] , @ins
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user