rubyx/test/compiler/fragments/test_while_fibo.rb

32 lines
436 B
Ruby
Raw Normal View History

require_relative 'helper'
class TestWhileFragment < MiniTest::Test
include Fragments
def test_while_fibo
@string_input = <<HERE
class Object
int fibonaccit(int n)
2015-10-27 10:00:48 +01:00
int a = 0
int b = 1
while_plus( n )
int tmp = a
a = b
b = tmp + b
n = n - 1
end
b.putint()
return b
end
2014-06-07 22:22:32 +02:00
int main()
fibonaccit( 10 )
end
end
HERE
2015-10-27 10:00:48 +01:00
@length = 5
2015-07-19 12:31:13 +02:00
check
end
2014-06-05 15:27:25 +02:00
end