2017-09-08 12:12:24 +02:00
|
|
|
|
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
2017-09-08 12:22:20 +02:00
|
|
|
class TestWhileConditionMom < MiniTest::Test
|
2017-09-08 12:12:24 +02:00
|
|
|
include MomCompile
|
|
|
|
|
|
|
|
def setup
|
|
|
|
Risc.machine.boot
|
2017-09-08 12:22:20 +02:00
|
|
|
@stats = compile_first_method_flat( "while(@a == 5) ; 5.mod4 ; end")
|
|
|
|
@first = @stats.next.next
|
2017-09-08 12:12:24 +02:00
|
|
|
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
|
2017-09-08 12:22:20 +02:00
|
|
|
assert_equal 4 , @stats.length
|
2017-09-08 12:12:24 +02:00
|
|
|
end
|
2017-09-09 22:36:43 +02:00
|
|
|
def test_array
|
|
|
|
check_array [Label,SlotConstant,TruthCheck,Label] , @stats
|
|
|
|
end
|
2017-09-08 12:12:24 +02:00
|
|
|
end
|
|
|
|
end
|