1 /*
   2  * Copyright (c) 2010, 2013, 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-8012334: ToUint32, ToInt32, and ToUint16 don't conform to spec
  26  *
  27  * @test
  28  * @run
  29  */
  30 
  31 
  32 function test(val) {
  33     print(val | 0);
  34     print(val >> 0);
  35     print(val >>> 0);
  36     print(1 >>> val);
  37     print(parseInt("10", val));
  38 }
  39 
  40 test(0);
  41 test(-0);
  42 test('Infinity');
  43 test('+Infinity');
  44 test('-Infinity');
  45 test(Number.POSITIVE_INFINITY);
  46 test(Number.NEGATIVE_INFINITY);
  47 test(Number.NaN);
  48 test(Number.MIN_VALUE);
  49 test(-Number.MIN_VALUE);
  50 test(1);
  51 test(-1);
  52 test(0.1);
  53 test(-0.1);
  54 test(1.1);
  55 test(-1.1);
  56 test(9223372036854775807);
  57 test(-9223372036854775808);
  58 test('9223372036854775807');
  59 test('-9223372036854775808');
  60 test(2147483647);
  61 test(2147483648);
  62 test(2147483649);
  63 test(-2147483647);
  64 test(-2147483648);
  65 test(-2147483649);
  66 test(4294967295);
  67 test(4294967296);
  68 test(4294967297);
  69 test(-4294967295);
  70 test(-4294967296);
  71 test(-4294967297);
  72 test(1e23);
  73 test(-1e23);
  74 test(1e24);
  75 test(-1e24);
  76 test(1e25);
  77 test(-1e25);
  78 test(1e26);
  79 test(-1e26);
  80