author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 34974 | nashorn/test/script/basic/JDK-8143896.js@94a13629c390 |
permissions | -rw-r--r-- |
34974
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
1 |
/* |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
4 |
* |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
8 |
* |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
13 |
* accompanied this code). |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
14 |
* |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
18 |
* |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
21 |
* questions. |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
22 |
*/ |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
23 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
24 |
/** |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
25 |
* JDK-8143896: java.lang.Long is implicitly converted to double |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
26 |
* |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
27 |
* @test |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
28 |
* @run |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
29 |
*/ |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
30 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
31 |
Assert.assertTrue(java.lang.Long.valueOf("301077366599181567").toString() === "301077366599181567"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
32 |
Assert.assertTrue(java.lang.Long.valueOf("-301077366599181567").toString() === "-301077366599181567"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
33 |
Assert.assertTrue(java.lang.Long.valueOf("301077366599181567") == 301077366599181567); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
34 |
Assert.assertFalse(java.lang.Long.valueOf("301077366599181567") === 301077366599181567); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
35 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
36 |
Assert.assertTrue(new java.math.BigInteger("301077366599181567").toString() === "301077366599181567"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
37 |
Assert.assertTrue(new java.math.BigInteger("-301077366599181567").toString() === "-301077366599181567"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
38 |
Assert.assertTrue(new java.math.BigInteger("301077366599181567") == 301077366599181567); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
39 |
Assert.assertFalse(new java.math.BigInteger("301077366599181567") === 301077366599181567); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
40 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
41 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
42 |
var n = new java.lang.Byte("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
43 |
Assert.assertTrue(typeof n === "number"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
44 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
45 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
46 |
Assert.assertTrue(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
47 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
48 |
n = new java.lang.Short("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
49 |
Assert.assertTrue(typeof n === "number"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
50 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
51 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
52 |
Assert.assertTrue(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
53 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
54 |
n = new java.lang.Integer("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
55 |
Assert.assertTrue(typeof n === "number"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
56 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
57 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
58 |
Assert.assertTrue(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
59 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
60 |
n = new java.lang.Float("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
61 |
Assert.assertTrue(typeof n === "number"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
62 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
63 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
64 |
Assert.assertTrue(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
65 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
66 |
n = new java.lang.Double("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
67 |
Assert.assertTrue(typeof n === "number"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
68 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
69 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
70 |
Assert.assertTrue(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
71 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
72 |
n = new java.lang.Long("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
73 |
Assert.assertTrue(typeof n === "object"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
74 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
75 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
76 |
Assert.assertFalse(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
77 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
78 |
n = new java.util.concurrent.atomic.DoubleAdder(); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
79 |
n.add("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
80 |
Assert.assertTrue(typeof n === "object"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
81 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
82 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
83 |
Assert.assertFalse(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
84 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
85 |
n = new java.util.concurrent.atomic.AtomicInteger(123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
86 |
Assert.assertTrue(typeof n === "object"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
87 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
88 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
89 |
Assert.assertFalse(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
90 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
91 |
n = new java.util.concurrent.atomic.AtomicLong(123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
92 |
Assert.assertTrue(typeof n === "object"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
93 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
94 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
95 |
Assert.assertFalse(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
96 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
97 |
n = new java.math.BigInteger("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
98 |
Assert.assertTrue(typeof n === "object"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
99 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
100 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
101 |
Assert.assertFalse(n === 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
102 |
|
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
103 |
n = new java.math.BigDecimal("123"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
104 |
Assert.assertTrue(typeof n === "object"); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
105 |
Assert.assertTrue(n + 1 === 124); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
106 |
Assert.assertTrue(n == 123); |
94a13629c390
8143896: java.lang.Long is implicitly converted to double
hannesw
parents:
diff
changeset
|
107 |
Assert.assertFalse(n === 123); |