2017-08-30 21:27:12 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Vool
|
2017-08-30 21:54:03 +02:00
|
|
|
class TestConditionIfMom < MiniTest::Test
|
2019-08-07 14:08:45 +02:00
|
|
|
include VoolCompile
|
2017-08-30 21:27:12 +02:00
|
|
|
|
|
|
|
def setup
|
2019-02-08 22:03:23 +01:00
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2018-06-29 23:39:23 +02:00
|
|
|
Risc::Builtin.boot_functions
|
2018-04-19 09:00:55 +02:00
|
|
|
@ins = compile_first_method( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end")
|
2017-08-30 21:27:12 +02:00
|
|
|
end
|
|
|
|
|
2019-08-07 14:08:45 +02:00
|
|
|
def pest_condition
|
2018-03-21 14:24:42 +01:00
|
|
|
assert_equal TruthCheck , @ins.next(4).class
|
2017-08-30 21:54:03 +02:00
|
|
|
end
|
2019-08-07 14:08:45 +02:00
|
|
|
def pest_condition_is_slot
|
2018-03-21 14:24:42 +01:00
|
|
|
assert_equal SlotDefinition , @ins.next(4).condition.class , @ins
|
2018-03-16 14:35:22 +01:00
|
|
|
end
|
2019-08-07 14:08:45 +02:00
|
|
|
def pest_hoisted_dynamic_call
|
2018-03-21 14:24:42 +01:00
|
|
|
assert_equal SimpleCall , @ins.next(2).class
|
2018-04-19 09:00:55 +02:00
|
|
|
assert_equal :div4 , @ins.next(2).method.name
|
2017-09-04 20:00:29 +02:00
|
|
|
end
|
2019-08-07 14:08:45 +02:00
|
|
|
def pest_array
|
2018-03-21 14:24:42 +01:00
|
|
|
check_array [MessageSetup, ArgumentTransfer, SimpleCall, SlotLoad, TruthCheck, Label ,
|
|
|
|
SlotLoad, Jump, Label, SlotLoad, Label] , @ins
|
2017-08-30 21:27:12 +02:00
|
|
|
end
|
2018-03-16 14:35:22 +01:00
|
|
|
|
2017-08-30 21:27:12 +02:00
|
|
|
end
|
|
|
|
end
|