add a person to the spam address...take stephen off for a while...
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / Fibheaps / TestRunner.java
1 package Fibheaps;
2
3 // the fibheap class
4 public class TestRunner extends Thread {
5
6   public TestRunner() {}
7
8   public void run() {
9     // generate test data
10     int iter = 1200; //200;
11     int seed = 1967;
12     //Vector testdata = new Vector(iter);
13     FibHeap fh = new FibHeap();
14     FibHeap fh_t = new FibHeap();
15     for(int i = 0; i < iter; i++) {
16       int rand = (77 * seed + 1) % 1024;
17       //testdata.addElement(new Integer(rand));
18       seed++;
19       fh = fh.insertFH(rand);
20       fh_t = fh_t.insertFH(rand);
21     }
22     // makeFH from the test data
23     /*FibHeap fh = new FibHeap();
24     for(int i = testdata.size(); i > 0; i++) {
25       fh = fh.insertFH((Integer)(testdata.elementAt(i-1)).intValue());
26     }
27     FibHeap fh_t = new FibHeap();
28     for(int i = testdata.size(); i > 0; i++) {
29       fh_t = fh_t.insertFH((Integer)(testdata.elementAt(i-1)).intValue());
30     }*/
31
32     int[] rfh = new int[iter];
33     int[] rfh_t = new int[iter];
34
35     int i = 0;
36     while(!fh.isEmpty()) {
37       rfh[i] = fh.minFH();
38       fh = fh.deleteMinFH();
39       i++;
40     }
41     int j = 0;
42     while(!fh_t.isEmpty()) {
43       rfh_t[j] = fh_t.minFH();
44       fh_t = fh_t.deleteMinFH_t();
45       j++;
46     }
47
48     if(i != j) {
49       // error!
50       System.exit(0xaa);
51     } else {
52       for(i = 0; i < j; i++) {
53         if(rfh[i] != rfh_t[i]) {
54           // error!
55           System.exit(0xbb);
56         }
57       }
58     }
59   }
60
61   public static void main(String[] args) {
62     int threadnum = 62;
63     for(int i = 0; i < threadnum; ++i) {
64       TestRunner tr = new TestRunner();
65       tr.start();
66     }
67   }
68 }