< prev index next >

test/jdk/jdk/incubator/vector/templates/Unit-header.template

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level


  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
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @modules jdk.incubator.vector
  27  * @run testng/othervm -ea -esa $vectorteststype$
  28  */
  29 
  30 import jdk.incubator.vector.Vector.Shape;
  31 import jdk.incubator.vector.Vector.Species;


  32 import jdk.incubator.vector.Vector;
  33 
  34 #if[Byte]
  35 import jdk.incubator.vector.ByteVector;
  36 #end[Byte]
  37 #if[Float]
  38 import jdk.incubator.vector.FloatVector;
  39 #end[Float]
  40 #if[Int]
  41 import jdk.incubator.vector.IntVector;
  42 #end[Int]
  43 #if[Double]
  44 import jdk.incubator.vector.DoubleVector;
  45 #end[Double]
  46 #if[Short]
  47 import jdk.incubator.vector.ShortVector;
  48 #end[Short]
  49 #if[Long]
  50 import jdk.incubator.vector.LongVector;
  51 #end[Long]
  52 
  53 import org.testng.Assert;
  54 import org.testng.annotations.DataProvider;
  55 import org.testng.annotations.Test;
  56 
  57 import java.lang.Integer;
  58 import java.util.List;
  59 #if[!byteOrShort]
  60 import java.util.Arrays;
  61 #end[!byteOrShort]
  62 import java.util.function.BiFunction;
  63 import java.util.function.IntFunction;
  64 import java.util.stream.Collectors;
  65 import java.util.stream.Stream;
  66 
  67 @Test
  68 public class $vectorteststype$ extends AbstractVectorTest {
  69 
  70 #if[MaxBit]
  71     static final Species<$Wideboxtype$> SPECIES =
  72                 $Type$Vector.SPECIES_MAX;
  73 #else[MaxBit]
  74     static final Species<$Wideboxtype$> SPECIES =
  75                 $Type$Vector.SPECIES_$bits$;
  76 #end[MaxBit]
  77 
  78     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  79 
  80 #if[MaxBit]
  81     static Shape getMaxBit() {
  82         return Shape.S_Max_BIT;
  83     }
  84 
  85 #end[MaxBit]
  86     interface FUnOp {
  87         $type$ apply($type$ a);
  88     }
  89 
  90     static void assertArraysEquals($type$[] a, $type$[] r, FUnOp f) {
  91         int i = 0;
  92         try {
  93             for (; i < a.length; i++) {
  94                 Assert.assertEquals(r[i], f.apply(a[i]));
  95             }
  96         } catch (AssertionError e) {
  97             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
  98         }
  99     }
 100 
 101     static void assertArraysEquals($type$[] a, $type$[] r, boolean[] mask, FUnOp f) {
 102         int i = 0;




  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
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @modules jdk.incubator.vector
  27  * @run testng/othervm -ea -esa $vectorteststype$
  28  */
  29 
  30 import jdk.incubator.vector.VectorShape;
  31 import jdk.incubator.vector.VectorSpecies;
  32 import jdk.incubator.vector.VectorShuffle;
  33 import jdk.incubator.vector.VectorMask;
  34 import jdk.incubator.vector.Vector;
  35 
  36 #if[Byte]
  37 import jdk.incubator.vector.ByteVector;
  38 #end[Byte]
  39 #if[Float]
  40 import jdk.incubator.vector.FloatVector;
  41 #end[Float]
  42 #if[Int]
  43 import jdk.incubator.vector.IntVector;
  44 #end[Int]
  45 #if[Double]
  46 import jdk.incubator.vector.DoubleVector;
  47 #end[Double]
  48 #if[Short]
  49 import jdk.incubator.vector.ShortVector;
  50 #end[Short]
  51 #if[Long]
  52 import jdk.incubator.vector.LongVector;
  53 #end[Long]
  54 
  55 import org.testng.Assert;
  56 import org.testng.annotations.DataProvider;
  57 import org.testng.annotations.Test;
  58 
  59 import java.lang.Integer;
  60 import java.util.List;
  61 #if[!byteOrShort]
  62 import java.util.Arrays;
  63 #end[!byteOrShort]
  64 import java.util.function.BiFunction;
  65 import java.util.function.IntFunction;
  66 import java.util.stream.Collectors;
  67 import java.util.stream.Stream;
  68 
  69 @Test
  70 public class $vectorteststype$ extends AbstractVectorTest {
  71 
  72 #if[MaxBit]
  73     static final VectorSpecies<$Wideboxtype$> SPECIES =
  74                 $Type$Vector.SPECIES_MAX;
  75 #else[MaxBit]
  76     static final VectorSpecies<$Wideboxtype$> SPECIES =
  77                 $Type$Vector.SPECIES_$bits$;
  78 #end[MaxBit]
  79 
  80     static final int INVOC_COUNT = Integer.getInteger("jdk.incubator.vector.test.loop-iterations", 100);
  81 
  82 #if[MaxBit]
  83     static VectorShape getMaxBit() {
  84         return VectorShape.S_Max_BIT;
  85     }
  86 
  87 #end[MaxBit]
  88     interface FUnOp {
  89         $type$ apply($type$ a);
  90     }
  91 
  92     static void assertArraysEquals($type$[] a, $type$[] r, FUnOp f) {
  93         int i = 0;
  94         try {
  95             for (; i < a.length; i++) {
  96                 Assert.assertEquals(r[i], f.apply(a[i]));
  97             }
  98         } catch (AssertionError e) {
  99             Assert.assertEquals(r[i], f.apply(a[i]), "at index #" + i + ", input = " + a[i]);
 100         }
 101     }
 102 
 103     static void assertArraysEquals($type$[] a, $type$[] r, boolean[] mask, FUnOp f) {
 104         int i = 0;


< prev index next >