< prev index next >

test/compiler/runtime/Test6778657.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke

*** 24,67 **** /* * @test * @bug 6778657 * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour */ ! public class Test { public static void check_f2i(int expect) { float check = expect; check *= 2; int actual = (int) check; ! if (actual != expect) throw new RuntimeException("expecting " + expect + ", got " + actual); } public static void check_f2l(long expect) { float check = expect; check *= 2; long actual = (long) check; ! if (actual != expect) throw new RuntimeException("expecting " + expect + ", got " + actual); } public static void check_d2i(int expect) { double check = expect; check *= 2; int actual = (int) check; ! if (actual != expect) throw new RuntimeException("expecting " + expect + ", got " + actual); } public static void check_d2l(long expect) { double check = expect; check *= 2; long actual = (long) check; ! if (actual != expect) throw new RuntimeException("expecting " + expect + ", got " + actual); } public static void main(String[] args) { check_f2i(Integer.MAX_VALUE); check_f2i(Integer.MIN_VALUE); check_f2l(Long.MAX_VALUE); --- 24,75 ---- /* * @test * @bug 6778657 * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour + * + * @run main compiler.runtime.Test6778657 */ ! package compiler.runtime; ! ! public class Test6778657 { public static void check_f2i(int expect) { float check = expect; check *= 2; int actual = (int) check; ! if (actual != expect) { throw new RuntimeException("expecting " + expect + ", got " + actual); } + } public static void check_f2l(long expect) { float check = expect; check *= 2; long actual = (long) check; ! if (actual != expect) { throw new RuntimeException("expecting " + expect + ", got " + actual); } + } public static void check_d2i(int expect) { double check = expect; check *= 2; int actual = (int) check; ! if (actual != expect) { throw new RuntimeException("expecting " + expect + ", got " + actual); } + } public static void check_d2l(long expect) { double check = expect; check *= 2; long actual = (long) check; ! if (actual != expect) { throw new RuntimeException("expecting " + expect + ", got " + actual); } + } public static void main(String[] args) { check_f2i(Integer.MAX_VALUE); check_f2i(Integer.MIN_VALUE); check_f2l(Long.MAX_VALUE);
< prev index next >