2014-05-27 14:31:31 +02:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
class TestRecursinveFibo < MiniTest::Test
|
|
|
|
include Fragments
|
|
|
|
|
|
|
|
def test_recursive_fibo
|
|
|
|
@string_input = <<HERE
|
2014-05-30 09:42:43 +02:00
|
|
|
def fibonaccir( n )
|
2014-05-28 19:13:03 +02:00
|
|
|
if( n <= 1 )
|
2015-07-19 12:31:13 +02:00
|
|
|
return n
|
2014-05-28 13:55:13 +02:00
|
|
|
else
|
2015-07-19 12:31:13 +02:00
|
|
|
a = fibonaccir( n - 1 )
|
2014-05-28 19:13:03 +02:00
|
|
|
b = fibonaccir( n - 2 )
|
|
|
|
return a + b
|
2014-05-28 13:55:13 +02:00
|
|
|
end
|
2014-06-07 23:56:40 +02:00
|
|
|
end
|
|
|
|
def fib_print(n)
|
|
|
|
fib = fibonaccir( n )
|
|
|
|
fib.putint()
|
|
|
|
end
|
|
|
|
|
|
|
|
fib_print(10)
|
2014-05-27 14:31:31 +02:00
|
|
|
HERE
|
2015-07-19 12:31:13 +02:00
|
|
|
@expect = [Virtual::Return ]
|
|
|
|
check
|
2014-05-27 14:31:31 +02:00
|
|
|
end
|
|
|
|
end
|