summaryrefslogtreecommitdiffstats
path: root/test/105-invoke
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-01-11 09:31:45 -0800
committerIan Rogers <irogers@google.com>2013-01-11 10:19:52 -0800
commite41931a27c0a9818c06d26621c05af9e4e187503 (patch)
tree3b4a489acacbc6a927b1a54480fff6f19ff7148c /test/105-invoke
parent3a226e3b1980a9c0814c20be628bae91848fa408 (diff)
downloadart-e41931a27c0a9818c06d26621c05af9e4e187503.tar.gz
art-e41931a27c0a9818c06d26621c05af9e4e187503.tar.bz2
art-e41931a27c0a9818c06d26621c05af9e4e187503.zip
Move Invoke to a run-test.
Change-Id: I3496e0bc88afb0ff0316b59b01cfc5a2df5aabfb
Diffstat (limited to 'test/105-invoke')
-rw-r--r--test/105-invoke/expected.txt1
-rw-r--r--test/105-invoke/info.txt1
-rw-r--r--test/105-invoke/src/Main.java104
3 files changed, 106 insertions, 0 deletions
diff --git a/test/105-invoke/expected.txt b/test/105-invoke/expected.txt
new file mode 100644
index 0000000000..e0ffebd720
--- /dev/null
+++ b/test/105-invoke/expected.txt
@@ -0,0 +1 @@
+invoke PASSED
diff --git a/test/105-invoke/info.txt b/test/105-invoke/info.txt
new file mode 100644
index 0000000000..fa794de735
--- /dev/null
+++ b/test/105-invoke/info.txt
@@ -0,0 +1 @@
+Tests simple method dispatch.
diff --git a/test/105-invoke/src/Main.java b/test/105-invoke/src/Main.java
new file mode 100644
index 0000000000..d5f3b62947
--- /dev/null
+++ b/test/105-invoke/src/Main.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+class Main implements InvokeInterface {
+
+ int virI_I(int a) {
+ return a + 123;
+ }
+
+ int virI_II(int a, int b) {
+ return a + b + 321;
+ }
+
+ int virI_III(int a, int b, int c) {
+ return a + b + c + 432;
+ }
+
+ int virI_IIII(int a, int b, int c, int d) {
+ return a + b + c + d + 919;
+ }
+
+ int virI_IIIII(int a, int b, int c, int d, int e) {
+ return a + b + c + d + e + 1010;
+ }
+
+ int virI_IIIIII(int a, int b, int c, int d, int e, int f) {
+ return a + b + c + d + e + f + 2020;
+ }
+
+ static int statI_I(int a) {
+ return a + 123;
+ }
+
+ static int statI_II(int a, int b) {
+ return a + b + 321;
+ }
+
+ static int statI_III(int a, int b, int c) {
+ return a + b + c + 432;
+ }
+
+ static int statI_IIII(int a, int b, int c, int d) {
+ return a + b + c + d + 919;
+ }
+
+ static int statI_IIIII(int a, int b, int c, int d, int e) {
+ return a + b + c + d + e + 1010;
+ }
+
+ static int statI_IIIIII(int a, int b, int c, int d, int e, int f) {
+ return a + b + c + d + e + f + 2020;
+ }
+
+ public int interfaceMethod(int i) {
+ return i + 23;
+ }
+
+ static int invoke(int a) {
+ Main foo = new Main();
+
+ return foo.virI_I(a) +
+ foo.virI_II(a, 1) +
+ foo.virI_III(a, 1, 2) +
+ foo.virI_IIII(a, 1, 2, 3) +
+ foo.virI_IIIII(a, 1, 2, 3, 4) +
+ foo.virI_IIIIII(a, 1, 2, 3, 4, 5) +
+ statI_I(a) +
+ statI_II(a, 1) +
+ statI_III(a, 1, 2) +
+ statI_IIII(a, 1, 2, 3) +
+ statI_IIIII(a, 1, 2, 3, 4) +
+ statI_IIIIII(a, 1, 2, 3, 4, 5) +
+ foo.interfaceMethod(a);
+ }
+
+ public static void main(String[] args) {
+ boolean failure = false;
+ int res = invoke(912);
+ if (res == 21599) {
+ System.out.println("invoke PASSED");
+ } else {
+ System.out.println("invoke FAILED: " + res);
+ failure = true;
+ }
+ System.exit(failure ? 1 : 0);
+ }
+}
+
+interface InvokeInterface {
+ int interfaceMethod(int i);
+}