This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mono / tests / bench1.cs
1 using System;
2
3 public class Benchmark {
4
5         public static int Run ()
6         {
7                 int count = 32;
8                 int[] fibs = new int [count + 1];
9                 int index;
10                 int index2;
11                 int temp;
12
13                 fibs[0] = 1;
14                 fibs[1] = 1;
15                 for(index = 2; index <= count; ++index)
16                 {
17                         fibs[index] = fibs[index - 2] + fibs [index - 1];
18                 }
19
20                 for(index = 0; index <= count; ++index)
21                 {
22                         for(index2 = 1; index2 <= count; ++index2)
23                         {
24                                 if(fibs[index2 - 1] < fibs[index2])
25                                 {
26                                         int ti = index2 - 1;
27                                         temp = fibs[ti];
28                                         fibs[ti] = fibs[index2];
29                                         fibs[index2] = temp;
30                                 }
31                         }
32                 }
33                 
34                 return fibs [0];
35         }
36
37         public static int Main () {
38                 for (int i = 0; i < 1000000; i++)
39                         if (Run () != 3524578)
40                                 return 1;
41
42                 return 0;
43         }
44 }
45
46