blob: eecead007345f266dbccf50b4902fdb7ab8b364a [file] [log] [blame]
jeffhao5d1ac922011-09-29 17:41:15 -07001/*
2 * Copyright (C) 2008 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
17/**
18 * Dalvik instruction exerciser.
19 */
20public class Main {
21 /*
22 * Start up.
23 */
24 public static void main(String[] args) {
jeffhao5d1ac922011-09-29 17:41:15 -070025 Main main = new Main();
26 main.run();
27
28 /* run through the heap to see if we trashed something */
29 System.gc();
30
31 System.out.println("Done!");
32 }
33
34 public void run() {
35 InstField instField = new InstField();
36 instField.run();
37
38 StaticField.run();
39
40 IntMath.run();
41 FloatMath.run();
42 Compare.run();
43
44 Monitor.run();
45 Switch.run();
46 Array.run();
47 Classes.run();
48 Goto.run();
49 MethodCall.run();
50 Throw.run();
51
52 try {
53 UnresTest1.run();
54 } catch (VerifyError ve) {
55 System.out.println("Caught: " + ve);
56 }
57 try {
58 UnresTest1.run();
59 } catch (VerifyError ve) {
60 System.out.println("Caught (retry): " + ve);
61 }
62
63 try {
64 UnresTest2.run();
65 } catch (VerifyError ve) {
66 System.out.println("Caught: " + ve);
67 } catch (NoClassDefFoundError ncdfe) {
68 /* UnresClass can cause desktop Java to freak out */
69 System.out.println("NOTE: UnresTest2 not available");
70 }
71 InternedString.run();
72 }
jeffhao795d78f2011-09-30 18:34:35 -070073
74 public static void assertTrue(boolean condition) {
75 if (!condition) {
76 throw new Error();
77 }
78 }
jeffhao5d1ac922011-09-29 17:41:15 -070079}