clearer organization for compiler tests
was slightly messy with small/large now needed different test for expression and statements
This commit is contained in:
34
test/compiler/fragments/test_recursive_fibo.rb
Normal file
34
test/compiler/fragments/test_recursive_fibo.rb
Normal file
@ -0,0 +1,34 @@
|
||||
require_relative 'helper'
|
||||
|
||||
class TestRecursinveFibo < MiniTest::Test
|
||||
include Fragments
|
||||
|
||||
def test_recursive_fibo
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
int fibonaccir( int n )
|
||||
if( n <= 1 )
|
||||
return n
|
||||
else
|
||||
int tmp
|
||||
tmp = n - 1
|
||||
int a = fibonaccir( tmp )
|
||||
tmp = n - 2
|
||||
int b = fibonaccir( tmp )
|
||||
return a + b
|
||||
end
|
||||
end
|
||||
int fib_print(int n)
|
||||
int fib = fibonaccir( n )
|
||||
fib.putint()
|
||||
end
|
||||
int main()
|
||||
fib_print(10)
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [[Virtual::MethodEnter,Register::GetSlot,Virtual::Set,Virtual::Set,
|
||||
Virtual::Set,Virtual::Set,Virtual::MethodCall] , [Virtual::MethodReturn]]
|
||||
check
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user