first while test working

fixed logic error in test framework
This commit is contained in:
Torsten Ruger
2018-03-16 12:33:11 +05:30
parent ea882f403a
commit 35a0952943
9 changed files with 71 additions and 58 deletions

View File

@ -4,24 +4,25 @@ require_relative "helper"
module Vool
class TestWhileConditionMom < MiniTest::Test
include MomCompile
include Mom
def setup
Risc.machine.boot
@stats = compile_first_method( "while(@a == 5) ; 5.mod4 ; end")
@first = @stats.first
@ins = compile_first_method( "while(5.mod4) ; 5.mod4 ; end")
end
def test_if_compiles_as_array
assert_equal Mom::WhileStatement , @first.class , @stats
end
def test_condition_compiles_to_slot
assert_equal Mom::TruthCheck , @first.condition.class
def test_condition_compiles_to_check
assert_equal TruthCheck , @ins.next(6).class
end
def test_condition_is_slot
assert_equal Mom::SlotDefinition , @first.condition.condition.class , @stats
assert_equal SlotDefinition , @ins.next(6).condition.class , @ins
end
def test_hoisetd
assert_equal Mom::SlotLoad , @first.hoisted.class
assert_equal MessageSetup , @ins.class
end
def test_array
check_array [MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,SlotLoad,Label,TruthCheck,MessageSetup,SlotLoad,ArgumentTransfer,SimpleCall,Jump,Label] , @ins
end
end
end