rubyx/test/risc/methods/test_call_fibo.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

44 lines
692 B
Ruby

require_relative 'helper'
module Methods
class TestFibo < MethodsTest
def test_count_down
run_space <<HERE
def down( n )
if( n < 2 )
return n
else
a = down(n - 1)
return a
end
end
def main(arg)
return down(8)
end
HERE
assert_equal 1 , get_return
end
def est_fibo
run_space <<HERE
def fibo_r( n )
if( n < 2 )
return n
else
a = fibo_r(n - 1)
b = fibo_r(n - 2)
return a + b
end
end
def main(arg)
return fibo_r(8)
end
HERE
assert_equal 8 , get_return
end
end
end