< prev index next >

test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/BoxPrimitiveDataProvider.java

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


   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 package jdk.vm.ci.hotspot.test;
  25 
  26 import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
  27 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
  28 
  29 import java.util.LinkedList;
  30 import jdk.vm.ci.meta.JavaConstant;
  31 import org.testng.annotations.DataProvider;
  32 





  33 public class BoxPrimitiveDataProvider {
  34 
  35     @DataProvider(name = "boxPrimitiveDataProvider")
  36     public static Object[][] boxPrimitiveDataProvider() {
  37         LinkedList<Object[]> cfgSet = new LinkedList<>();
  38         // Boolean testing
  39         cfgSet.add(
  40                         new Object[]{JavaConstant.forBoolean(true), CONSTANT_REFLECTION_PROVIDER.forObject(true)});
  41         cfgSet.add(new Object[]{JavaConstant.forBoolean(false),
  42                         CONSTANT_REFLECTION_PROVIDER.forObject(false)});
  43         // Boxed boolean testing (returns null)
  44         cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(true), null});
  45         cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(false), null});
  46         for (byte number : new byte[]{-128, 0, 1, 127}) {
  47             // Integer primitives testing
  48             cfgSet.add(new Object[]{JavaConstant.forByte(number),
  49                             CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number))});
  50             cfgSet.add(new Object[]{JavaConstant.forShort(number),
  51                             CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number))});
  52             cfgSet.add(new Object[]{JavaConstant.forInt(number),




   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 package jdk.vm.ci.hotspot.test;
  25 




  26 import jdk.vm.ci.meta.JavaConstant;
  27 import org.testng.annotations.DataProvider;
  28 
  29 import java.util.LinkedList;
  30 
  31 import static jdk.vm.ci.hotspot.test.TestHelper.CONSTANT_REFLECTION_PROVIDER;
  32 import static jdk.vm.ci.hotspot.test.TestHelper.DUMMY_CLASS_INSTANCE;
  33 
  34 public class BoxPrimitiveDataProvider {
  35 
  36     @DataProvider(name = "boxPrimitiveDataProvider")
  37     public static Object[][] boxPrimitiveDataProvider() {
  38         LinkedList<Object[]> cfgSet = new LinkedList<>();
  39         // Boolean testing
  40         cfgSet.add(
  41                         new Object[]{JavaConstant.forBoolean(true), CONSTANT_REFLECTION_PROVIDER.forObject(true)});
  42         cfgSet.add(new Object[]{JavaConstant.forBoolean(false),
  43                         CONSTANT_REFLECTION_PROVIDER.forObject(false)});
  44         // Boxed boolean testing (returns null)
  45         cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(true), null});
  46         cfgSet.add(new Object[]{CONSTANT_REFLECTION_PROVIDER.forObject(false), null});
  47         for (byte number : new byte[]{-128, 0, 1, 127}) {
  48             // Integer primitives testing
  49             cfgSet.add(new Object[]{JavaConstant.forByte(number),
  50                             CONSTANT_REFLECTION_PROVIDER.forObject(Byte.valueOf(number))});
  51             cfgSet.add(new Object[]{JavaConstant.forShort(number),
  52                             CONSTANT_REFLECTION_PROVIDER.forObject(Short.valueOf(number))});
  53             cfgSet.add(new Object[]{JavaConstant.forInt(number),


< prev index next >