1 /*
   2  * Copyright (c) 2016, 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 package org.graalvm.compiler.jtt.bytecode;
  25 
  26 import java.util.ArrayList;
  27 import java.util.Collection;
  28 import java.util.List;
  29 
  30 import org.junit.runner.RunWith;
  31 import org.junit.runners.Parameterized;
  32 import org.junit.runners.Parameterized.Parameter;
  33 import org.junit.runners.Parameterized.Parameters;
  34 
  35 import org.graalvm.compiler.jtt.JTTTest;
  36 
  37 @RunWith(Parameterized.class)
  38 public abstract class BC_float_base extends JTTTest {
  39 
  40     /** Some interesting values. */
  41     private static final float[] values = {
  42                     0.0f,
  43                     -0.0f,
  44                     1.0f,
  45                     -1.0f,
  46                     Float.POSITIVE_INFINITY,
  47                     Float.NEGATIVE_INFINITY,
  48                     Float.NaN,
  49                     10.0f,
  50                     -10.0f,
  51                     311.0f,
  52                     -311.0f,
  53     };
  54 
  55     @Parameters(name = "{0}, {1}")
  56     public static Collection<Object[]> data() {
  57         List<Object[]> d = new ArrayList<>();
  58         for (int i = 0; i < values.length; i++) {
  59             float x = values[i];
  60             for (int j = 0; j < values.length; j++) {
  61                 float y = values[j];
  62                 d.add(new Object[]{x, y});
  63             }
  64         }
  65         return d;
  66     }
  67 
  68     @Parameter(value = 0) public float x;
  69     @Parameter(value = 1) public float y;
  70 
  71 }