diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:28:47 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 19:28:47 -0800 |
| commit | f6c387128427e121477c1b32ad35cdcaa5101ba3 (patch) | |
| tree | 2aa25fa8c8c3a9caeecf98fd8ac4cd9b12717997 /tests/052-verifier-fun | |
| parent | f72d5de56a522ac3be03873bdde26f23a5eeeb3c (diff) | |
| download | android_dalvik-f6c387128427e121477c1b32ad35cdcaa5101ba3.tar.gz android_dalvik-f6c387128427e121477c1b32ad35cdcaa5101ba3.tar.bz2 android_dalvik-f6c387128427e121477c1b32ad35cdcaa5101ba3.zip | |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'tests/052-verifier-fun')
| -rw-r--r-- | tests/052-verifier-fun/expected.txt | 2 | ||||
| -rw-r--r-- | tests/052-verifier-fun/info.txt | 6 | ||||
| -rw-r--r-- | tests/052-verifier-fun/src/Blah.java | 4 | ||||
| -rw-r--r-- | tests/052-verifier-fun/src/BlahFeature.java | 3 | ||||
| -rw-r--r-- | tests/052-verifier-fun/src/BlahOne.java | 5 | ||||
| -rw-r--r-- | tests/052-verifier-fun/src/BlahTwo.java | 5 | ||||
| -rw-r--r-- | tests/052-verifier-fun/src/Main.java | 110 |
7 files changed, 135 insertions, 0 deletions
diff --git a/tests/052-verifier-fun/expected.txt b/tests/052-verifier-fun/expected.txt new file mode 100644 index 000000000..566267534 --- /dev/null +++ b/tests/052-verifier-fun/expected.txt @@ -0,0 +1,2 @@ +BlahOne +Zorch. diff --git a/tests/052-verifier-fun/info.txt b/tests/052-verifier-fun/info.txt new file mode 100644 index 000000000..08127da23 --- /dev/null +++ b/tests/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/tests/052-verifier-fun/src/Blah.java b/tests/052-verifier-fun/src/Blah.java new file mode 100644 index 000000000..edd6c9d3e --- /dev/null +++ b/tests/052-verifier-fun/src/Blah.java @@ -0,0 +1,4 @@ +public abstract class Blah { + public void unrelatedStuff() { + } +} diff --git a/tests/052-verifier-fun/src/BlahFeature.java b/tests/052-verifier-fun/src/BlahFeature.java new file mode 100644 index 000000000..ea0e18aa3 --- /dev/null +++ b/tests/052-verifier-fun/src/BlahFeature.java @@ -0,0 +1,3 @@ +public interface BlahFeature { + public void doStuff(); +} diff --git a/tests/052-verifier-fun/src/BlahOne.java b/tests/052-verifier-fun/src/BlahOne.java new file mode 100644 index 000000000..ed423cdf3 --- /dev/null +++ b/tests/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/tests/052-verifier-fun/src/BlahTwo.java b/tests/052-verifier-fun/src/BlahTwo.java new file mode 100644 index 000000000..cff367091 --- /dev/null +++ b/tests/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/tests/052-verifier-fun/src/Main.java b/tests/052-verifier-fun/src/Main.java new file mode 100644 index 000000000..81ff654a4 --- /dev/null +++ b/tests/052-verifier-fun/src/Main.java @@ -0,0 +1,110 @@ +// 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(); + } +} + |
