nitdoc: remove unused plugin "Copy to Clipboard"
[nit.git] / tests / test_ni_fibonacci.nit.c
1 /* This file is part of NIT ( http://www.nitlanguage.org ).
2 *
3 * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
4 *
5 * This file is free software, which comes along with NIT. This software is
6 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 * is kept unaltered, and a notification of the changes is added.
10 * You are allowed to redistribute it and sell it, alone or is a part of
11 * another product.
12 */
13
14 #include "test_ni_fibonacci.nit.h"
15
16
17 /*
18 C implementation of fibonacci::FibonacciEngine::fibonacci
19
20 Imported methods signatures:
21 bigint FibonacciEngine_fibonacci( FibonacciEngine recv, bigint n ) for fibonacci::FibonacciEngine::fibonacci
22 */
23 bigint FibonacciEngine_fibonacci___impl( FibonacciEngine recv, bigint n )
24 {
25 if ( n == 0 )
26 return 0;
27 if ( n == 1 )
28 return 1;
29 else
30 return FibonacciEngine_fibonacci( recv, n-1 ) + FibonacciEngine_fibonacci( recv, n-2 );
31 }
32
33 /*
34 C implementation of fibonacci::Int::fibonacci
35
36 Imported methods signatures:
37 bigint Int_fibonacci( bigint recv ) for fibonacci::Int::fibonacci
38 */
39 bigint Int_fibonacci___impl( bigint recv )
40 {
41 if ( recv == 0 )
42 return 0;
43 else if ( recv == 1 )
44 return 1;
45 else
46 return Int_fibonacci( recv-1 ) + Int_fibonacci( recv-2 );
47 }