2018-04-26 11:33:33 +02:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
module Methods
|
|
|
|
class TestCallCond < MethodsTest
|
|
|
|
|
|
|
|
def if_cond( arg )
|
|
|
|
str = <<HERE
|
|
|
|
def called( n )
|
|
|
|
if( n < 10)
|
|
|
|
return 10
|
|
|
|
else
|
|
|
|
return 20
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def main(arg)
|
|
|
|
return called( ARG )
|
|
|
|
end
|
|
|
|
HERE
|
|
|
|
str.sub("ARG" , arg.to_s)
|
|
|
|
end
|
|
|
|
def test_call_sm
|
|
|
|
run_space if_cond(8)
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal 10 , get_return
|
2018-04-26 11:33:33 +02:00
|
|
|
end
|
|
|
|
def test_call_lg
|
|
|
|
run_space if_cond(18)
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal 20 , get_return
|
2018-04-26 11:33:33 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|