rubyx/test/risc/methods/test_call_cond.rb
Torsten Ruger 5f7683efcf pass return integer back out through exit
for testing of binaries later (and off course general correctness)
Some tests were using the fact that the interpreter was used, changed those to return ints rather than strings
2018-06-19 18:55:47 +03:00

31 lines
534 B
Ruby

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
end
def test_call_lg
run_space if_cond(18)
assert_equal 20 , get_return
end
end
end