rubyx/test/fragments/test_recursive_fibo.rb

31 lines
471 B
Ruby
Raw Normal View History

require_relative 'helper'
class TestRecursinveFibo < MiniTest::Test
include Fragments
def test_recursive_fibo
@string_input = <<HERE
2015-09-20 15:52:26 +02:00
int fib_print(int n)
2015-09-27 15:06:48 +02:00
int fib = fibonaccir( n )
2014-06-07 23:56:40 +02:00
fib.putint()
end
2015-09-20 15:52:26 +02:00
int fibonaccir( int n )
if( n <= 1 )
return n
else
2015-09-27 15:06:48 +02:00
int tmp
tmp = n - 1
int a = fibonaccir( tmp )
2015-09-20 15:52:26 +02:00
tmp = n - 2
2015-09-27 15:06:48 +02:00
int b = fibonaccir( tmp )
2015-09-20 15:52:26 +02:00
return a + b
end
end
2014-06-07 23:56:40 +02:00
fib_print(10)
HERE
2015-07-19 12:31:13 +02:00
@expect = [Virtual::Return ]
check
end
end