5f7683efcf
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
31 lines
534 B
Ruby
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
|