Fixed more disabled tests

This commit is contained in:
2019-08-13 11:14:36 +03:00
parent aaf169ad8d
commit 8036b23593
10 changed files with 59 additions and 56 deletions

View File

@ -2,26 +2,25 @@ require_relative "helper"
module VoolBlocks
class TestConditionIfMom < MiniTest::Test
include MomCompile
include Mom
include VoolCompile
def setup
Parfait.boot!(Parfait.default_test_options)
#Risc::Builtin.boot_functions
Mom::Builtin.boot_functions
@ins = compile_first_block( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
end
def pest_condition
def test_condition
assert_equal TruthCheck , @ins.next(4).class
end
def pest_condition_is_slot
def test_condition_is_slot
assert_equal SlotDefinition , @ins.next(4).condition.class , @ins
end
def pest_hoisted_dynamic_call
def test_hoisted_dynamic_call
assert_equal SimpleCall , @ins.next(2).class
assert_equal :div4 , @ins.next(2).method.name
end
def pest_array
def test_array
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, TruthCheck, Label ,
SlotLoad, Jump, Label, SlotLoad, Label] , @ins
end

View File

@ -6,23 +6,24 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
Risc::Builtin.boot_functions
@ins = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
@compiler = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
@ins = @compiler.mom_instructions.next
end
def pest_condition
def test_condition
assert_equal TruthCheck , @ins.next(4).class
end
def pest_condition_is_slot
def test_condition_is_slot
assert_equal SlotDefinition , @ins.next(4).condition.class , @ins
end
def pest_hoisted_dynamic_call
def test_hoisted_dynamic_call
assert_equal SimpleCall , @ins.next(2).class
assert_equal :div4 , @ins.next(2).method.name
end
def pest_array
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, TruthCheck, Label ,
SlotLoad, Jump, Label, SlotLoad, Label] , @ins
def test_array
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, TruthCheck,
Label ,SlotLoad, Jump, Label, SlotLoad, Label,
Label, ReturnSequence, Label ] , @ins
end
end

View File

@ -43,16 +43,16 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
Risc.boot!
@compiler = compile_first_method( "return 5.div4")
@ins = @compiler.mom_instructions.next
end
def pest_return_is_last
assert_equal ReturnJump , @ins.last.class
def test_return_is_last
assert_equal ReturnJump , @ins.next(5).class
end
def pest_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,SlotLoad,ReturnJump] , @ins
def test_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,
SlotLoad,ReturnJump, Label, ReturnSequence, Label] , @ins
end
end
end

View File

@ -7,31 +7,30 @@ module Vool
def setup
Parfait.boot!(Parfait.default_test_options)
Risc::Builtin.boot_functions
@compiler = compile_first_method( "while(5.div4) ; 5.div4 ; end")
@ins = @compiler.mom_instructions.next
end
def pest_condition_compiles_to_check
def test_condition_compiles_to_check
assert_equal TruthCheck , @ins.next(5).class
end
def pest_condition_is_slot
def test_condition_is_slot
assert_equal SlotDefinition , @ins.next(5).condition.class , @ins
end
def pest_hoisetd
def test_hoisetd
jump = @ins.next(9)
assert_kind_of Jump , jump
assert jump.label.name.start_with?("cond_label") , jump.label.name
end
def pest_label
def test_label
label = @ins
assert_equal Label , label.class
assert label.name.start_with?("cond_label") , label.name
end
def pest_array
def test_array
check_array [Label, MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad ,
TruthCheck, MessageSetup, ArgumentTransfer, SimpleCall, Jump ,
Label] , @ins
Label, Label, ReturnSequence, Label] , @ins
end
end