summaryrefslogtreecommitdiffstats
path: root/test/052-verifier-fun
diff options
context:
space:
mode:
authorjeffhao <jeffhao@google.com>2011-09-29 17:41:15 -0700
committerjeffhao <jeffhao@google.com>2011-09-29 17:41:15 -0700
commit5d1ac920fdaef5d4ec8f66bb734488cd9660b024 (patch)
treedd372f306ab70f4c86759869b1f74eca62ff6f2b /test/052-verifier-fun
parentc31664f3d82e6cd68275a529a8a73f067a52e8be (diff)
downloadandroid_art-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.tar.gz
android_art-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.tar.bz2
android_art-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.zip
Adding old unit tests to test suite.
These tests are copied straight over. They'll still run, but they're using the old system. Change-Id: If494519e52ddf858a9febfc55bdae830468cb3c8
Diffstat (limited to 'test/052-verifier-fun')
-rw-r--r--test/052-verifier-fun/expected.txt2
-rw-r--r--test/052-verifier-fun/info.txt6
-rw-r--r--test/052-verifier-fun/src/Blah.java4
-rw-r--r--test/052-verifier-fun/src/BlahFeature.java3
-rw-r--r--test/052-verifier-fun/src/BlahOne.java5
-rw-r--r--test/052-verifier-fun/src/BlahTwo.java5
-rw-r--r--test/052-verifier-fun/src/Main.java109
7 files changed, 134 insertions, 0 deletions
diff --git a/test/052-verifier-fun/expected.txt b/test/052-verifier-fun/expected.txt
new file mode 100644
index 0000000000..566267534e
--- /dev/null
+++ b/test/052-verifier-fun/expected.txt
@@ -0,0 +1,2 @@
+BlahOne
+Zorch.
diff --git a/test/052-verifier-fun/info.txt b/test/052-verifier-fun/info.txt
new file mode 100644
index 0000000000..08127da231
--- /dev/null
+++ b/test/052-verifier-fun/info.txt
@@ -0,0 +1,6 @@
+This is a miscellaneous test that was imported into the new-at-the-time
+runtime test framework. The test is intended to exercise basic features,
+and as such cannot be build on top of junit, since failure of such basic
+features might disrupt junit.
+
+TODO: Real description goes here.
diff --git a/test/052-verifier-fun/src/Blah.java b/test/052-verifier-fun/src/Blah.java
new file mode 100644
index 0000000000..edd6c9d3ec
--- /dev/null
+++ b/test/052-verifier-fun/src/Blah.java
@@ -0,0 +1,4 @@
+public abstract class Blah {
+ public void unrelatedStuff() {
+ }
+}
diff --git a/test/052-verifier-fun/src/BlahFeature.java b/test/052-verifier-fun/src/BlahFeature.java
new file mode 100644
index 0000000000..ea0e18aa32
--- /dev/null
+++ b/test/052-verifier-fun/src/BlahFeature.java
@@ -0,0 +1,3 @@
+public interface BlahFeature {
+ public void doStuff();
+}
diff --git a/test/052-verifier-fun/src/BlahOne.java b/test/052-verifier-fun/src/BlahOne.java
new file mode 100644
index 0000000000..ed423cdf39
--- /dev/null
+++ b/test/052-verifier-fun/src/BlahOne.java
@@ -0,0 +1,5 @@
+public class BlahOne extends Blah implements BlahFeature {
+ public void doStuff() {
+ System.out.println("BlahOne");
+ }
+}
diff --git a/test/052-verifier-fun/src/BlahTwo.java b/test/052-verifier-fun/src/BlahTwo.java
new file mode 100644
index 0000000000..cff3670912
--- /dev/null
+++ b/test/052-verifier-fun/src/BlahTwo.java
@@ -0,0 +1,5 @@
+public class BlahTwo extends Blah implements BlahFeature {
+ public void doStuff() {
+ System.out.println("BlahTwo");
+ }
+}
diff --git a/test/052-verifier-fun/src/Main.java b/test/052-verifier-fun/src/Main.java
new file mode 100644
index 0000000000..ca960cf4d4
--- /dev/null
+++ b/test/052-verifier-fun/src/Main.java
@@ -0,0 +1,109 @@
+// Copyright 2007 The Android Open Source Project
+
+import java.lang.reflect.Type;
+
+/**
+ * Throw a few things at the verifier, all of which are expected to pass.
+ */
+public class Main {
+ static public void main(String[] args) {
+ tryBlah(1);
+
+ System.out.println("Zorch.");
+ }
+
+ /*
+ * Make sure the verifier is handling type merge of arrays of
+ * references correctly.
+ */
+ static Object[] arrayCheck1(int wanted) {
+ String[] arrayOne;
+ Integer[] arrayTwo;
+
+ arrayOne = new String[1];
+ arrayTwo = new Integer[1];
+
+ switch (wanted) {
+ case 0: return arrayOne;
+ case 1: return arrayTwo;
+ default: return null;
+ }
+ }
+
+ static Object arrayCheck1b(int wanted) {
+ String[] arrayOne;
+ Integer[] arrayTwo;
+ int[] arrayThree;
+
+ arrayOne = new String[1];
+ arrayTwo = new Integer[1];
+ arrayThree = new int[1];
+
+ switch (wanted) {
+ case 0: return arrayOne;
+ case 1: return arrayTwo;
+ case 2: return arrayThree;
+ default: return null;
+ }
+ }
+
+ static Object[] arrayCheck2(int wanted) {
+ String[][] arrayOne;
+ String[][] arrayTwo;
+ Integer[][] arrayThree;
+
+ arrayOne = new String[1][];
+ arrayTwo = new String[1][];
+ arrayThree = new Integer[1][];
+
+ switch (wanted) {
+ case 0: return arrayOne;
+ case 1: return arrayTwo;
+ case 2: return arrayThree;
+ default: return null;
+ }
+ }
+
+ static Object[] arrayCheck3(int wanted) {
+ String[][] arrayTwo;
+ String[][][][] arrayFour;
+
+ arrayTwo = new String[1][];
+ arrayFour = new String[1][][][];
+
+ switch (wanted) {
+ case 0: return arrayTwo;
+ case 1: return arrayFour;
+ default: return null;
+ }
+ }
+
+ /*
+ * Check return type merge.
+ */
+ private Type[] typeTest() {
+ if(this == null) {
+ return (Class<?>[])null;
+ }
+ return (Type[])null;
+ }
+
+
+ /*
+ * Exercise the blahs.
+ */
+ static void tryBlah(int num) {
+ BlahFeature feature = null; // interface ref
+
+ switch (num) {
+ case 1:
+ feature = new BlahOne();
+ break;
+ default:
+ feature = new BlahTwo();
+ break;
+ }
+
+ feature.doStuff();
+ }
+}