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-11-30 16:20:39 +02:00
|
|
|
class Space
|
2015-10-06 00:27:13 +03:00
|
|
|
int fibonaccir( int n )
|
2015-11-14 00:22:00 +02:00
|
|
|
if_plus( n - 2 )
|
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()
|
2015-11-05 17:00:41 +02:00
|
|
|
return fib
|
2015-10-07 10:04:55 +03:00
|
|
|
end
|
2015-10-06 00:27:13 +03:00
|
|
|
int main()
|
2015-11-10 11:44:55 +02:00
|
|
|
return fib_print(8)
|
2015-09-20 16:52:26 +03:00
|
|
|
end
|
|
|
|
end
|
2014-05-27 15:31:31 +03:00
|
|
|
HERE
|
2015-11-10 11:44:55 +02:00
|
|
|
@length = 2525
|
2015-11-18 13:04:57 +02:00
|
|
|
check 21
|
2014-05-27 15:31:31 +03:00
|
|
|
end
|
|
|
|
end
|