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 * @test
26 * @bug 6582946
27 * @summary Test the primitive wrappers compare and compareTo methods
28 */
29
30 import java.util.Random;
31
32 public class Compare {
33
34 final Random rnd = new Random();
35
36 boolean toBoolean(long x) { return x > 0; }
37
38 void compareAll(long x, long y) {
39 check(Double.compare(x, y) ==
40 Double.valueOf(x).compareTo(Double.valueOf(y)));
41 check(Float.compare(x, y) ==
42 Float.valueOf(x).compareTo(Float.valueOf(y)));
43 check(Long.compare(x, y) ==
44 Long.valueOf(x).compareTo(Long.valueOf(y)));
45 check(Integer.compare((int) x, (int) y) ==
46 Integer.valueOf((int) x).compareTo(Integer.valueOf((int) y)));
47 check(Short.compare((short) x, (short) y) ==
|
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 * @test
26 * @bug 6582946
27 * @summary Test the primitive wrappers compare and compareTo methods
28 * @key randomness
29 */
30
31 import java.util.Random;
32
33 public class Compare {
34
35 final Random rnd = new Random();
36
37 boolean toBoolean(long x) { return x > 0; }
38
39 void compareAll(long x, long y) {
40 check(Double.compare(x, y) ==
41 Double.valueOf(x).compareTo(Double.valueOf(y)));
42 check(Float.compare(x, y) ==
43 Float.valueOf(x).compareTo(Float.valueOf(y)));
44 check(Long.compare(x, y) ==
45 Long.valueOf(x).compareTo(Long.valueOf(y)));
46 check(Integer.compare((int) x, (int) y) ==
47 Integer.valueOf((int) x).compareTo(Integer.valueOf((int) y)));
48 check(Short.compare((short) x, (short) y) ==
|