rubyx/test/risc/methods/test_call_cond.rb

31 lines
534 B
Ruby
Raw Normal View History

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)
assert_equal 10 , get_return
2018-04-26 11:33:33 +02:00
end
def test_call_lg
run_space if_cond(18)
assert_equal 20 , get_return
2018-04-26 11:33:33 +02:00
end
end
end