author | mchung |
Thu, 28 May 2015 10:54:48 -0700 | |
changeset 30820 | 0d4717a011d3 |
parent 28302 | 5de69b0d3a84 |
child 34781 | 479b1724ab80 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
19196
diff
changeset
|
2 |
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2 | 22 |
*/ |
23 |
||
24 |
/* @test |
|
25 |
* @summary Unit test for formatter |
|
26 |
* @bug 4906370 4962433 4973103 4989961 5005818 5031150 4970931 4989491 5002937 |
|
27 |
* 5005104 5007745 5061412 5055180 5066788 5088703 6317248 6318369 6320122 |
|
19196
5368bd038f19
6476168: (fmt) Inconsistency formatting subnormal doubles with hexadecimal conversion
bpb
parents:
18545
diff
changeset
|
28 |
* 6344623 6369500 6534606 6282094 6286592 6476425 5063507 6469160 6476168 |
28302
5de69b0d3a84
8059175: Zero BigDecimal with negative scale prints leading zeroes in String.format
bpb
parents:
23010
diff
changeset
|
29 |
* 8059175 |
2 | 30 |
* |
30820 | 31 |
* @modules java.base/sun.misc |
2 | 32 |
* @run shell/timeout=240 Basic.sh |
33 |
*/ |
|
34 |
||
35 |
import static java.lang.System.out; |
|
36 |
||
37 |
public class Basic { |
|
38 |
||
39 |
private static int fail = 0; |
|
40 |
private static int pass = 0; |
|
41 |
||
42 |
private static Throwable first; |
|
43 |
||
44 |
static void pass() { |
|
45 |
pass++; |
|
46 |
} |
|
47 |
||
48 |
static void fail(String fs, Class ex) { |
|
49 |
String s = "'" + fs + "': " + ex.getName() + " not thrown"; |
|
50 |
if (first == null) |
|
51 |
setFirst(s); |
|
52 |
System.err.println("FAILED: " + s); |
|
53 |
fail++; |
|
54 |
} |
|
55 |
||
56 |
static void fail(String fs, String exp, String got) { |
|
57 |
String s = "'" + fs + "': Expected '" + exp + "', got '" + got + "'"; |
|
58 |
if (first == null) |
|
59 |
setFirst(s); |
|
60 |
System.err.println("FAILED: " + s); |
|
61 |
fail++; |
|
62 |
} |
|
63 |
||
64 |
private static void setFirst(String s) { |
|
65 |
try { |
|
66 |
throw new RuntimeException(s); |
|
67 |
} catch (RuntimeException x) { |
|
68 |
first = x; |
|
69 |
} |
|
70 |
} |
|
71 |
||
72 |
static void ck(String fs, String exp, String got) { |
|
73 |
if (!exp.equals(got)) |
|
74 |
fail(fs, exp, got); |
|
75 |
else |
|
76 |
pass(); |
|
77 |
} |
|
78 |
||
79 |
public static void main(String[] args) { |
|
80 |
BasicBoolean.test(); |
|
81 |
BasicBooleanObject.test(); |
|
82 |
BasicByte.test(); |
|
83 |
BasicByteObject.test(); |
|
84 |
BasicChar.test(); |
|
85 |
BasicCharObject.test(); |
|
86 |
BasicShort.test(); |
|
87 |
BasicShortObject.test(); |
|
88 |
BasicInt.test(); |
|
89 |
BasicIntObject.test(); |
|
90 |
BasicLong.test(); |
|
91 |
BasicLongObject.test(); |
|
92 |
BasicBigInteger.test(); |
|
93 |
BasicFloat.test(); |
|
94 |
BasicFloatObject.test(); |
|
95 |
BasicDouble.test(); |
|
96 |
BasicDoubleObject.test(); |
|
97 |
BasicBigDecimal.test(); |
|
98 |
||
99 |
BasicDateTime.test(); |
|
100 |
||
101 |
if (fail != 0) |
|
102 |
throw new RuntimeException((fail + pass) + " tests: " |
|
103 |
+ fail + " failure(s), first", first); |
|
104 |
else |
|
105 |
out.println("all " + (fail + pass) + " tests passed"); |
|
106 |
} |
|
107 |
} |