| anuvarsh | 673bd50 | 2019-06-27 16:44:11 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | public class Main { |
| 17 | public class A { |
| 18 | public int value; |
| 19 | } |
| 20 | |
| 21 | public static void assertIntEquals(int expected, int result) { |
| 22 | if (expected != result) { |
| 23 | throw new Error("Expected: " + expected + ", found: " + result); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | public long testLoop() { |
| 28 | A x; |
| 29 | x = new A(); |
| 30 | int a0 = 0x7; |
| 31 | |
| 32 | int i = 0; |
| 33 | while (i < 10000000) { |
| 34 | a0++; |
| 35 | x.value = a0; |
| 36 | |
| 37 | if (i % 2 == 0) { |
| 38 | i++; |
| 39 | continue; |
| 40 | } |
| 41 | i = i + 2; |
| 42 | } |
| 43 | assertIntEquals(x.value, 5000008); |
| 44 | return x.value; |
| 45 | } |
| 46 | |
| 47 | public static void main(String[] args) { |
| 48 | Main obj = new Main(); |
| 49 | obj.testLoop(); |
| 50 | } |
| 51 | } |