rubyx/test/mom/test_if_statement.rb
Torsten Ruger e6e8522b4e fix order of pops
slightly embarrassingly was popping (from the end)
rather than shifting (from the start)
2018-03-12 18:13:07 +05:30

31 lines
783 B
Ruby

require_relative "helper"
module Mom
class TestConditionIfMom < MiniTest::Test
include MomCompile
def setup
Risc.machine.boot
@stats = compile_first_method_flat( "if(@a == 5) ; 5.mod4 ; else; 4.mod4 ; end")
@first = @stats.next
end
def test_if_compiles
assert IfStatement != @stats.class , @stats
end
def test_check
assert_equal TruthCheck , @first.class
end
def test_condition_is_slot
assert_equal SlotDefinition , @first.condition.class , @first
end
def test_length
assert_equal 11 , @stats.length
end
def test_array
check_array [SlotMove,TruthCheck,Label,MessageSetup,ArgumentTransfer,SimpleCall,Label,MessageSetup,ArgumentTransfer,SimpleCall,Label] , @stats
end
end
end