summaryrefslogtreecommitdiffstats
path: root/test/041-narrowing
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/041-narrowing
parentc31664f3d82e6cd68275a529a8a73f067a52e8be (diff)
downloadart-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.tar.gz
art-5d1ac920fdaef5d4ec8f66bb734488cd9660b024.tar.bz2
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/041-narrowing')
-rw-r--r--test/041-narrowing/expected.txt38
-rw-r--r--test/041-narrowing/info.txt6
-rw-r--r--test/041-narrowing/src/Main.java99
3 files changed, 143 insertions, 0 deletions
diff --git a/test/041-narrowing/expected.txt b/test/041-narrowing/expected.txt
new file mode 100644
index 0000000000..93b85901cf
--- /dev/null
+++ b/test/041-narrowing/expected.txt
@@ -0,0 +1,38 @@
+
+Double.POSITIVE_INFINITY = 7ff0000000000000
+Double.NEGATIVE_INFINITY = fff0000000000000
+Float.POSITIVE_INFINITY = 7ff0000000000000
+Float.NEGATIVE_INFINITY = fff0000000000000
+Double.NaN = 7ff8000000000000
+Float.NaN = 7ff8000000000000
+
+(byte) Double.NaN = 00 expected: 00
+(short) Double.NaN = 0000 expected: 0000
+(int) Double.NaN = 00000000 expected: 00000000
+(long) Double.NaN = 0000000000000000 expected: 0000000000000000
+
+(byte) Float.NaN = 00 expected: 00
+(short) Float.NaN = 0000 expected: 0000
+(int) Float.NaN = 00000000 expected: 00000000
+(long) Float.NaN = 0000000000000000 expected: 0000000000000000
+
+(byte) Double.POSITIVE_INFINITY = ff expected: ff
+(short) Double.POSITIVE_INFINITY = ffff expected: ffff
+(int) Double.POSITIVE_INFINITY = 7fffffff expected: 7fffffff
+(long) Double.POSITIVE_INFINITY = 7fffffffffffffff expected: 7fffffffffffffff
+
+(byte) Double.NEGATIVE_INFINITY = 00 expected: 00
+(short) Double.NEGATIVE_INFINITY = 0000 expected: 0000
+(int) Double.NEGATIVE_INFINITY = 80000000 expected: 80000000
+(long) Double.NEGATIVE_INFINITY = 8000000000000000 expected: 8000000000000000
+
+(byte) Float.POSITIVE_INFINITY = ff expected: ff
+(short) Float.POSITIVE_INFINITY = ffff expected: ffff
+(int) Float.POSITIVE_INFINITY = 7fffffff expected: 7fffffff
+(long) Float.POSITIVE_INFINITY = 7fffffffffffffff expected: 7fffffffffffffff
+
+(byte) Float.NEGATIVE_INFINITY = 00 expected: 00
+(short) Float.NEGATIVE_INFINITY = 0000 expected: 0000
+(int) Float.NEGATIVE_INFINITY = 80000000 expected: 80000000
+(long) Float.NEGATIVE_INFINITY = 8000000000000000 expected: 8000000000000000
+
diff --git a/test/041-narrowing/info.txt b/test/041-narrowing/info.txt
new file mode 100644
index 0000000000..08127da231
--- /dev/null
+++ b/test/041-narrowing/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/041-narrowing/src/Main.java b/test/041-narrowing/src/Main.java
new file mode 100644
index 0000000000..eb9d64a33b
--- /dev/null
+++ b/test/041-narrowing/src/Main.java
@@ -0,0 +1,99 @@
+public class Main {
+ public static void main(String[] args) {
+ test_printNarrowing();
+ }
+
+ public static void test_printNarrowing() {
+
+ System.out.println();
+ System.out.println("Double.POSITIVE_INFINITY = "
+ + Long.toHexString(Double.doubleToRawLongBits(Double.POSITIVE_INFINITY)));
+ System.out.println("Double.NEGATIVE_INFINITY = "
+ + Long.toHexString(Double.doubleToRawLongBits(Double.NEGATIVE_INFINITY)));
+ System.out.println("Float.POSITIVE_INFINITY = "
+ + Long.toHexString(Double.doubleToRawLongBits(Float.POSITIVE_INFINITY)));
+ System.out.println("Float.NEGATIVE_INFINITY = "
+ + Long.toHexString(Double.doubleToRawLongBits(Float.NEGATIVE_INFINITY)));
+ System.out.println("Double.NaN = "
+ + Long.toHexString(Double.doubleToRawLongBits(Double.NaN)));
+ System.out.println("Float.NaN = "
+ + Long.toHexString(Double.doubleToRawLongBits(Float.NaN)));
+ double dbl2 = Double.NaN;
+ System.out.println();
+ System.out.println("(byte) Double.NaN = "
+ + (Long.toHexString((byte)dbl2).equals("0") ? "00" : Long.toHexString((byte)dbl2)
+ .substring(6)) + " expected: 00");
+ System.out.println("(short) Double.NaN = "
+ + (Integer.toHexString((short)dbl2).equals("0") ? "0000" : Integer.toHexString(
+ (short)dbl2).substring(4)) + " expected: 0000");
+ System.out.println("(int) Double.NaN = "
+ + (Integer.toHexString((int)dbl2).equals("0") ? "00000000" : Integer
+ .toHexString((int)dbl2)) + " expected: 00000000");
+ System.out.println("(long) Double.NaN = "
+ + (Long.toHexString((long)dbl2).equals("0") ? "0000000000000000" : Long
+ .toHexString((long)dbl2)) + " expected: 0000000000000000");
+ float fl2 = Float.NaN;
+ System.out.println();
+ System.out.println("(byte) Float.NaN = "
+ + (Long.toHexString((byte)fl2).equals("0") ? "00" : Long.toHexString((byte)fl2)
+ .substring(6)) + " expected: 00");
+ System.out.println("(short) Float.NaN = "
+ + (Integer.toHexString((short)fl2).equals("0") ? "0000" : Integer.toHexString(
+ (short)fl2).substring(4)) + " expected: 0000");
+ System.out.println("(int) Float.NaN = "
+ + (Integer.toHexString((int)fl2).equals("0") ? "00000000" : Integer
+ .toHexString((int)fl2)) + " expected: 00000000");
+ System.out.println("(long) Float.NaN = "
+ + (Long.toHexString((long)fl2).equals("0") ? "0000000000000000" : Long
+ .toHexString((long)fl2)) + " expected: 0000000000000000");
+ double dbl3 = Double.POSITIVE_INFINITY;
+ System.out.println();
+ System.out.println("(byte) Double.POSITIVE_INFINITY = "
+ + (Integer.toHexString((byte)dbl3).equals("0") ? "00" : Integer.toHexString(
+ (byte)dbl3).substring(6)) + " expected: ff");
+ System.out.println("(short) Double.POSITIVE_INFINITY = "
+ + (Integer.toHexString((short)dbl3).equals("0") ? "0000" : Integer.toHexString(
+ (short)dbl3).substring(4)) + " expected: ffff");
+ System.out.println("(int) Double.POSITIVE_INFINITY = "
+ + Integer.toHexString((int)dbl3) + " expected: 7fffffff");
+ System.out.println("(long) Double.POSITIVE_INFINITY = " + Long.toHexString((long)dbl3)
+ + " expected: 7fffffffffffffff");
+ double dbl4 = Double.NEGATIVE_INFINITY;
+ System.out.println();
+ System.out.println("(byte) Double.NEGATIVE_INFINITY = "
+ + (Long.toHexString((byte)dbl4).equals("0") ? " 00" : Long
+ .toHexString((byte)dbl4)) + " expected: 00");
+ System.out.println("(short) Double.NEGATIVE_INFINITY = "
+ + (Integer.toHexString((short)dbl4).equals("0") ? " 0000" : Long
+ .toHexString((short)dbl4)) + " expected: 0000");
+ System.out.println("(int) Double.NEGATIVE_INFINITY = "
+ + Integer.toHexString((int)dbl4) + " expected: 80000000");
+ System.out.println("(long) Double.NEGATIVE_INFINITY = " + Long.toHexString((long)dbl4)
+ + " expected: 8000000000000000");
+ float fl3 = Float.POSITIVE_INFINITY;
+ System.out.println();
+ System.out.println("(byte) Float.POSITIVE_INFINITY = "
+ + (Integer.toHexString((byte)fl3).equals("0") ? "00" : Integer.toHexString(
+ (byte)fl3).substring(6)) + " expected: ff");
+ System.out.println("(short) Float.POSITIVE_INFINITY = "
+ + (Integer.toHexString((short)fl3).equals("0") ? "0000" : Integer.toHexString(
+ (short)fl3).substring(4)) + " expected: ffff");
+ System.out.println("(int) Float.POSITIVE_INFINITY = "
+ + Integer.toHexString((int)fl3) + " expected: 7fffffff");
+ System.out.println("(long) Float.POSITIVE_INFINITY = " + Long.toHexString((long)fl3)
+ + " expected: 7fffffffffffffff");
+ float fl4 = Float.NEGATIVE_INFINITY;
+ System.out.println();
+ System.out.println("(byte) Float.NEGATIVE_INFINITY = "
+ + (Long.toHexString((byte)fl4).equals("0") ? " 00" : Long
+ .toHexString((byte)fl4)) + " expected: 00");
+ System.out.println("(short) Float.NEGATIVE_INFINITY = "
+ + (Integer.toHexString((short)fl4).equals("0") ? " 0000" : Long
+ .toHexString((short)fl4)) + " expected: 0000");
+ System.out.println("(int) Float.NEGATIVE_INFINITY = "
+ + Integer.toHexString((int)fl4) + " expected: 80000000");
+ System.out.println("(long) Float.NEGATIVE_INFINITY = " + Long.toHexString((long)fl4)
+ + " expected: 8000000000000000");
+ System.out.println();
+ }
+}