adding a test case
[IRC.git] / Robust / src / Tests / mlp / regression / test.java
1 public class Foo {
2   public int z;
3
4   public Foo( int z ) {
5     this.z = z;
6   }  
7 }
8
9 public class Test {
10
11   public static void main( String args[] ) {        
12     int x = Integer.parseInt( args[0] );
13     Foo f = new Foo( x + 10000 );
14     int s = doSomeWork( x, f );
15     int t = moreWork( x, f );
16     nullMethodBodyFinalNode();
17     int r = s+t;
18     System.out.println( "s = "+s+
19                         ", t = "+t+
20                         ", r = "+r );
21   }
22
23   public static int doSomeWork( int x, Foo f ) {
24     float delta = 1.0f;
25     int out = 0;
26     for( int i = 0; i < x; ++i ) {
27       sese calc {
28         Foo g = new Foo( i );
29         int sum = 0;
30         for( int j = 0; j <= i % 10; ++j ) {
31           sum = calculateStuff( sum, 1, 0 );
32         }        
33       }
34       sese forceVirtualReal {
35         if( i % 7 == 0 ) {
36           sum = sum + (i % 20);
37         }        
38         for( int z = 0; z < x % 50; ++z ) {
39           if( i % 2 == 0 ) {
40             delta += 1.0f;
41           }
42         }
43         g.z = sum + 1000;
44       }
45       sese arrayAlloc {
46         int tempArray[] = new int[x];
47         for( int k = 0; k < x/20; ++k ) {
48           tempArray[k] = g.z / (i+1);          
49         }        
50       }
51       sese gather {
52         int inter = 1;
53         for( int k = 0; k < x/20; ++k ) {
54           inter = inter + tempArray[k];
55         }             
56         sum = sum + inter / 10;
57       }
58       sese modobj {
59         g.z = g.z + f.z;
60       }
61       if( i % 11 == 0 ) {
62         sese change {
63           for( int k = 0; k < i*2; ++k ) {
64             sum = calculateStuff( sum, k, 1 );
65           }
66           sum = sum + 1;
67         }       
68         
69         for( int l = 0; l < 3; ++l ) {
70           sum = calculateStuff( sum, 2, 2 );
71         }       
72       } 
73       sese prnt {
74         if( i == x - 1 ) {
75           out = x + i + sum + (int)delta + g.z;
76         }
77       }
78     }
79     return out;
80   }
81
82   public static int calculateStuff( int sum, int num, int mode ) {
83     int answer = sum;    
84     sese makePlaceholderStallAfter {
85       sum = sum + 1;
86     }
87     sum = sum + 1;
88     if( mode == 0 ) {
89       sese mode1 {
90         answer = sum + num;
91       }
92     } else if( mode == 1 ) {
93       sese mode2 {
94         answer = sum + (num/2);
95       }
96     } else {
97       sese mode3 {
98         answer = sum / num;
99       }
100     }    
101     return answer;
102   }
103
104   public static int moreWork( int x, Foo f ) {
105
106     int total = 0;
107
108     for( int j = 0; j < x; ++j ) {
109       sese doe {
110         Foo g = new Foo( j );
111         int prod = 1;
112       }
113       sese rae {
114         if( j % 7 == 0 ) {
115           prod = prod * j;
116         }
117         g.z = prod / x;
118       }
119       sese mi {
120         g.z = g.z + f.z;
121       }
122       if( j % 3 == 0 ) {
123         sese fa {
124           prod = prod / 2;
125         }
126       }
127
128       total = total + prod - g.z;
129     }
130
131     return total;
132   }
133
134   public static void nullMethodBodyFinalNode() {
135     int y = 1;
136     sese nothing {
137       int x = 0;
138     }
139     y = x;
140     if( x > y ) {
141       return;
142     } else {
143       return;
144     }
145   }
146 }