aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pureJava/LiteralsCp.java
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/pureJava/LiteralsCp.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/pureJava/LiteralsCp.java')
-rw-r--r--tests/pureJava/LiteralsCp.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/pureJava/LiteralsCp.java b/tests/pureJava/LiteralsCp.java
new file mode 100644
index 000000000..dbe335b36
--- /dev/null
+++ b/tests/pureJava/LiteralsCp.java
@@ -0,0 +1,62 @@
+import org.aspectj.testing.Tester;
+
+public class LiteralsCp {
+ public static void main(String[] args) {
+ float f;
+ double d;
+ f = 0;
+ f = 0.0f;
+ f = 0000000.0000000f;
+ f = 1e-44f; //NOT ERROR: rounds to DENORM
+
+ f = 3.40282347e+38f;
+ f = 1.40239846e-45f;
+
+ d = 0e1;
+
+ d = 1.79769313486231570e+308;
+ d = 4.94065645841246544e-324;
+
+ int i, i1, i2, i3;
+ long l, l1, l2, l3;
+
+ i1 = 2147483647; //MAX_INT
+ i2 = 0x7fffffff;
+ i3 = 017777777777;
+ checkEqual(i1, i2, i3, "MAX_INT");
+
+ i1 = -2147483648; //MIN_INT
+ i2 = 0x80000000;
+ i3 = 020000000000;
+ checkEqual(i1, i2, i3, "MIN_INT");
+ //System.out.println(i1 + ", " + i2 + ", " + i3);
+
+ i1 = -1;
+ i2 = 0xffffffff;
+ i3 = 037777777777;
+ checkEqual(i1, i2, i3, "-1");
+
+ l1 = 9223372036854775807L; //MAX_LONG
+ l2 = 0x7fffffffffffffffL;
+ l3 = 0777777777777777777777L;
+ checkEqual(l1, l2, l3, "MAX_LONG");
+
+ //System.out.println(l1 + ", " + l2 + ", " + l3);
+
+ l1 = -9223372036854775808L; //MIN_LONG
+ l2 = 0x8000000000000000L;
+ l3 = 01000000000000000000000L;
+ checkEqual(l1, l2, l3, "MIN_LONG");
+
+ l1 = -1l;
+ l2 = 0xffffffffffffffffL;
+ l3 = 01777777777777777777777L;
+ checkEqual(l1, l2, l3, "-1L");
+ }
+
+ static void checkEqual(long i1, long i2, long i3, String msg) {
+ Tester.check(i1 == i2, msg + ": " + i1 + " == " + i2);
+ Tester.check(i1 == i3, msg + ": " + i1 + " == " + i3);
+ Tester.check(i2 == i3, msg + ": " + i2 + " == " + i3);
+ }
+}