rubyx/test/vool/lambdas/test_if_condition.rb

29 lines
782 B
Ruby
Raw Normal View History

2018-07-18 12:57:38 +02:00
require_relative "helper"
module VoolBlocks
2018-07-21 11:51:20 +02:00
class TestConditionIfMom < MiniTest::Test
2019-08-13 10:14:36 +02:00
include VoolCompile
2018-07-18 12:57:38 +02:00
def setup
@ins = compile_main_block( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
2018-07-18 12:57:38 +02:00
end
2019-08-13 10:14:36 +02:00
def test_condition
assert_equal TruthCheck , @ins.next(3).class
2018-07-18 12:57:38 +02:00
end
2019-08-13 10:14:36 +02:00
def test_condition_is_slot
assert_equal SlotDefinition , @ins.next(3).condition.class , @ins
2018-07-18 12:57:38 +02:00
end
def test_simple_call
2018-07-18 12:57:38 +02:00
assert_equal SimpleCall , @ins.next(2).class
assert_equal :div4 , @ins.next(2).method.name
end
2019-08-13 10:14:36 +02:00
def test_array
check_array [MessageSetup, ArgumentTransfer, SimpleCall, TruthCheck, Label ,
SlotLoad, Jump, Label, SlotLoad, Label ,
Label, ReturnSequence, Label] , @ins
2018-07-18 12:57:38 +02:00
end
end
end