test/script/basic/JDK-8062799.js

changeset 1092
8b689e3169e2
child 1482
58791cd01bc9
equal deleted inserted replaced
1091:628304057fce 1092:8b689e3169e2
1 /*
2 * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
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 *
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.
22 */
23
24 /**
25 * JDK-8062799: Binary logical expressions can have numeric types
26 *
27 * @test
28 * @run
29 */
30
31 (function() {
32 var inspect = Java.type("jdk.nashorn.test.tools.StaticTypeInspector").inspect;
33
34 var b = true;
35 var i = 1;
36 var l = 4294967296;
37 var d = 2.1;
38 var o = "foo";
39
40 print(inspect(b || b, "b || b"));
41 print(inspect(b || i, "b || i"));
42 print(inspect(b || l, "b || l"));
43 print(inspect(b || d, "b || d"));
44 print(inspect(b || o, "b || o"));
45
46 print(inspect(i || b, "i || b"));
47 print(inspect(i || i, "i || i"));
48 print(inspect(i || l, "i || l"));
49 print(inspect(i || d, "i || d"));
50 print(inspect(i || o, "i || o"));
51
52 print(inspect(l || b, "l || b"));
53 print(inspect(l || i, "l || i"));
54 print(inspect(l || l, "l || l"));
55 print(inspect(l || d, "l || d"));
56 print(inspect(l || o, "l || o"));
57
58 print(inspect(d || b, "d || b"));
59 print(inspect(d || i, "d || i"));
60 print(inspect(d || l, "d || l"));
61 print(inspect(d || d, "d || d"));
62 print(inspect(d || o, "d || o"));
63
64 print(inspect(o || b, "o || b"));
65 print(inspect(o || i, "o || i"));
66 print(inspect(o || l, "o || l"));
67 print(inspect(o || d, "o || d"));
68 print(inspect(o || o, "o || o"));
69
70 print(inspect(b && b, "b && b"));
71 print(inspect(b && i, "b && i"));
72 print(inspect(b && l, "b && l"));
73 print(inspect(b && d, "b && d"));
74 print(inspect(b && o, "b && o"));
75
76 print(inspect(i && b, "i && b"));
77 print(inspect(i && i, "i && i"));
78 print(inspect(i && l, "i && l"));
79 print(inspect(i && d, "i && d"));
80 print(inspect(i && o, "i && o"));
81
82 print(inspect(l && b, "l && b"));
83 print(inspect(l && i, "l && i"));
84 print(inspect(l && l, "l && l"));
85 print(inspect(l && d, "l && d"));
86 print(inspect(l && o, "l && o"));
87
88 print(inspect(d && b, "d && b"));
89 print(inspect(d && i, "d && i"));
90 print(inspect(d && l, "d && l"));
91 print(inspect(d && d, "d && d"));
92 print(inspect(d && o, "d && o"));
93
94 print(inspect(o && b, "o && b"));
95 print(inspect(o && i, "o && i"));
96 print(inspect(o && l, "o && l"));
97 print(inspect(o && d, "o && d"));
98 print(inspect(o && o, "o && o"));
99 })();
100
101
102
103

mercurial