Merge pull request #1109 from adbre/iss358
[mono.git] / mono / tests / gc-descriptors / descriptor-tests-driver.cs
1 public class DescriptorTest
2 {
3         public static void Main ()
4         {
5                 var r = new Random (31415);
6                 var objs = new object [9];
7                 var which = 0;
8                 var last = new Filler [Bitmaps.NumWhich];
9                 for (var i = 0; i < 1000000000; ++i)
10                 {
11                         var o = Bitmaps.MakeAndFill (which, objs, r.Next (2) == 0);
12                         objs [r.Next (objs.Length)] = o;
13                         last [which] = o;
14
15                         if (i % 761 == 0)
16                         {
17                                 var l = last [r.Next (Bitmaps.NumWhich)];
18                                 if (l != null)
19                                         l.Fill (objs);
20                         }
21
22                         /*
23                           if (i % 10007 == 0)
24                           Console.WriteLine (o.GetType ().Name + " " + which);
25                         */
26
27                         if (i % 5 == 0)
28                                 objs [r.Next (objs.Length)] = null;
29
30                         if (++which >= Bitmaps.NumWhich)
31                                 which = 0;
32                 }
33         }
34 }