Wed, 26 Jun 2013 18:03:58 -0700
8014137: Update test/tools/javac/literals/UnderscoreLiterals to add testcases with min/max values
Reviewed-by: jjg, darcy
Contributed-by: matherey.nunez@oracle.com
test/tools/javac/literals/UnderscoreLiterals.java | file | annotate | diff | comparison | revisions |
1.1 --- a/test/tools/javac/literals/UnderscoreLiterals.java Wed Jun 26 09:54:46 2013 -0700 1.2 +++ b/test/tools/javac/literals/UnderscoreLiterals.java Wed Jun 26 18:03:58 2013 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -42,6 +42,12 @@ 1.11 test(1_0_0, 100); 1.12 test(1__0__0, 100); 1.13 test(123_456_789, 123456789); 1.14 + test(2_147_483_647, Integer.MAX_VALUE); 1.15 + test(-2_147_483_648, Integer.MIN_VALUE); 1.16 + test(32_767, Short.MAX_VALUE); 1.17 + test(-32_768, Short.MIN_VALUE); 1.18 + test(1_2_7, Byte.MAX_VALUE); 1.19 + test(-1_2_8, Byte.MIN_VALUE); 1.20 1.21 // long 1.22 test(1l, 1l); 1.23 @@ -51,6 +57,8 @@ 1.24 test(1_0_0l, 100l); 1.25 test(1__0__0l, 100l); 1.26 test(123_456_789l, 123456789l); 1.27 + test(9_223_372_036_854_775_807l, Long.MAX_VALUE); 1.28 + test(-9_223_372_036_854_775_808l, Long.MIN_VALUE); 1.29 1.30 // float 1.31 test(.1f, .1f); 1.32 @@ -80,6 +88,8 @@ 1.33 test(1_1.1_0_0f, 1_1.100f); 1.34 test(1_1.1__0__0f, 1_1.100f); 1.35 test(1_1.123_456_789f, 1_1.123456789f); 1.36 + test(3.4_028_235E38f, Float.MAX_VALUE); 1.37 + test(1.4E-4_5f, Float.MIN_VALUE); 1.38 1.39 // double 1.40 test(.1d, .1d); 1.41 @@ -109,6 +119,8 @@ 1.42 test(1_1.1_0_0d, 1_1.100d); 1.43 test(1_1.1__0__0d, 1_1.100d); 1.44 test(1_1.123_456_789d, 1_1.123456789d); 1.45 + test(1.797_6_9_3_1_348_623_157E3_08, Double.MAX_VALUE); 1.46 + test(4.9E-3_24, Double.MIN_VALUE); 1.47 1.48 // binary 1.49 test(0b1, 1); 1.50 @@ -118,6 +130,14 @@ 1.51 test(0b1_0_0, 4); 1.52 test(0b1__0__0, 4); 1.53 test(0b0001_0010_0011, 0x123); 1.54 + test(0b111_1111_1111_1111_1111_1111_1111_1111, Integer.MAX_VALUE); 1.55 + test(0b1000_0000_0000_0000_0000_0000_0000_0000, Integer.MIN_VALUE); 1.56 + test(0b111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111l, Long.MAX_VALUE); 1.57 + test(0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000l, Long.MIN_VALUE); 1.58 + test(0b111_1111_1111_1111, Short.MAX_VALUE); 1.59 + test((short)-0b1000_0000_0000_0000, Short.MIN_VALUE); 1.60 + test(0b111_1111, Byte.MAX_VALUE); 1.61 + test((byte)-0b1000_0000, Byte.MIN_VALUE); 1.62 1.63 // octal 1.64 test(01, 1); 1.65 @@ -133,6 +153,14 @@ 1.66 test(0_1_0_0, 64); 1.67 test(0_1__0__0, 64); 1.68 test(0_001_002_003, 01002003); 1.69 + test(0177_7777_7777, Integer.MAX_VALUE); 1.70 + test(-0200_0000_0000, Integer.MIN_VALUE); 1.71 + test(077_77_77_77_77_7_77_77_77_77_77l, Long.MAX_VALUE); 1.72 + test(-010_00_00_00_00_00_00_00_00_00_00l, Long.MIN_VALUE); 1.73 + test((short)07_77_77, Short.MAX_VALUE); 1.74 + test((short)-010_00_00, Short.MIN_VALUE); 1.75 + test(01_77, Byte.MAX_VALUE); 1.76 + test((byte)-02_00, Byte.MIN_VALUE); 1.77 1.78 // hexadecimal 1.79 test(0x1, 1); 1.80 @@ -142,6 +170,18 @@ 1.81 test(0x1_0_0, 256); 1.82 test(0x1__0__0, 256); 1.83 test(0x01_02_03_04, 0x1020304); 1.84 + test(0x7f_ff_ff_ff, Integer.MAX_VALUE); 1.85 + test(0x80_00_00_00, Integer.MIN_VALUE); 1.86 + test(0x1.f_ff_ffep127f, Float.MAX_VALUE); 1.87 + test(0x0.00_00_02p-126f, Float.MIN_VALUE); 1.88 + test(0x1.f__ff_ff_ff_ff_ff_ffp1_023, Double.MAX_VALUE); 1.89 + test(0x0.000_000_000_000_1p-1_022, Double.MIN_VALUE); 1.90 + test(0x7f_ff_ff_ff_ff_ff_ff_ffl, Long.MAX_VALUE); 1.91 + test(0x80_00_00_00_00_00_00_00l, Long.MIN_VALUE); 1.92 + test(0x7f_ff, Short.MAX_VALUE); 1.93 + test((short)0x80_00, Short.MIN_VALUE); 1.94 + test(0x7_f, Byte.MAX_VALUE); 1.95 + test((byte)0x8_0, Byte.MIN_VALUE); 1.96 1.97 // misc 1.98 long creditCardNumber = 1234_5678_9012_3456L;