2014-05-27 15:31:31 +03:00
|
|
|
require_relative 'helper'
|
|
|
|
|
|
|
|
class TestRecursinveFibo < MiniTest::Test
|
|
|
|
include Fragments
|
|
|
|
|
|
|
|
def test_recursive_fibo
|
|
|
|
@string_input = <<HERE
|
2015-10-07 10:04:55 +03:00
|
|
|
class Object
|
2015-10-06 00:27:13 +03:00
|
|
|
int fibonaccir( int n )
|
2015-10-27 11:00:48 +02:00
|
|
|
if_plus( n - 1 )
|
2015-10-06 00:27:13 +03:00
|
|
|
int tmp
|
|
|
|
tmp = n - 1
|
|
|
|
int a = fibonaccir( tmp )
|
|
|
|
tmp = n - 2
|
|
|
|
int b = fibonaccir( tmp )
|
|
|
|
return a + b
|
2015-10-27 11:00:48 +02:00
|
|
|
else
|
|
|
|
return n
|
2015-10-06 00:27:13 +03:00
|
|
|
end
|
|
|
|
end
|
2015-10-07 10:04:55 +03:00
|
|
|
int fib_print(int n)
|
|
|
|
int fib = fibonaccir( n )
|
|
|
|
fib.putint()
|
|
|
|
end
|
2015-10-06 00:27:13 +03:00
|
|
|
int main()
|
|
|
|
fib_print(10)
|
2015-09-20 16:52:26 +03:00
|
|
|
end
|
|
|
|
end
|
2014-05-27 15:31:31 +03:00
|
|
|
HERE
|
2015-10-27 21:04:46 +02:00
|
|
|
@length = 78
|
2015-07-19 13:31:13 +03:00
|
|
|
check
|
2014-05-27 15:31:31 +03:00
|
|
|
end
|
|
|
|
end
|