blob: e8c30ef4936a77b77925bb06f9c50fae7e6a0667 [file] [log] [blame]
buzbee109bd6a2011-09-06 13:58:41 -07001/*
2 * Copyright (C) 2011 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
Brian Carlstrom25c33252011-09-18 15:58:35 -070017class Invoke implements InvokeInterface {
buzbee109bd6a2011-09-06 13:58:41 -070018
19 int virI_I(int a) {
20 return a + 123;
21 }
22
23 int virI_II(int a, int b) {
24 return a + b + 321;
25 }
26
27 int virI_III(int a, int b, int c) {
28 return a + b + c + 432;
29 }
30
31 int virI_IIII(int a, int b, int c, int d) {
32 return a + b + c + d + 919;
33 }
34
35 int virI_IIIII(int a, int b, int c, int d, int e) {
36 return a + b + c + d + e + 1010;
37 }
38
39 int virI_IIIIII(int a, int b, int c, int d, int e, int f) {
40 return a + b + c + d + e + f + 2020;
41 }
42
43 static int statI_I(int a) {
44 return a + 123;
45 }
46
47 static int statI_II(int a, int b) {
48 return a + b + 321;
49 }
50
51 static int statI_III(int a, int b, int c) {
52 return a + b + c + 432;
53 }
54
55 static int statI_IIII(int a, int b, int c, int d) {
56 return a + b + c + d + 919;
57 }
58
59 static int statI_IIIII(int a, int b, int c, int d, int e) {
60 return a + b + c + d + e + 1010;
61 }
62
63 static int statI_IIIIII(int a, int b, int c, int d, int e, int f) {
64 return a + b + c + d + e + f + 2020;
65 }
66
Brian Carlstrom25c33252011-09-18 15:58:35 -070067 public int interfaceMethod(int i) {
68 return i + 23;
69 }
70
71 static int invoke(int a) {
buzbee109bd6a2011-09-06 13:58:41 -070072 Invoke foo = new Invoke();
73
74 return foo.virI_I(a) +
75 foo.virI_II(a, 1) +
76 foo.virI_III(a, 1, 2) +
77 foo.virI_IIII(a, 1, 2, 3) +
78 foo.virI_IIIII(a, 1, 2, 3, 4) +
79 foo.virI_IIIIII(a, 1, 2, 3, 4, 5) +
80 statI_I(a) +
81 statI_II(a, 1) +
82 statI_III(a, 1, 2) +
83 statI_IIII(a, 1, 2, 3) +
84 statI_IIIII(a, 1, 2, 3, 4) +
Brian Carlstrom25c33252011-09-18 15:58:35 -070085 statI_IIIIII(a, 1, 2, 3, 4, 5) +
86 foo.interfaceMethod(a);
buzbee109bd6a2011-09-06 13:58:41 -070087 }
88
89 public static void main(String[] args) {
Brian Carlstrom25c33252011-09-18 15:58:35 -070090 boolean failure = false;
91 int res = invoke(912);
92 if (res == 21599) {
93 System.out.println("invoke PASSED");
buzbee109bd6a2011-09-06 13:58:41 -070094 } else {
Brian Carlstrom25c33252011-09-18 15:58:35 -070095 System.out.println("invoke FAILED: " + res);
96 failure = true;
buzbee109bd6a2011-09-06 13:58:41 -070097 }
Brian Carlstrom25c33252011-09-18 15:58:35 -070098 System.exit(failure ? 1 : 0);
buzbee109bd6a2011-09-06 13:58:41 -070099 }
100}
Brian Carlstrom25c33252011-09-18 15:58:35 -0700101
102interface InvokeInterface {
103 int interfaceMethod(int i);
104}