< prev index next >

test/jdk/jdk/incubator/vector/PreferredSpeciesTest.java

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


  33  * @run testng PreferredSpeciesTest
  34  */
  35 
  36 public class PreferredSpeciesTest {
  37     static final Unsafe U = Unsafe.getUnsafe();
  38 
  39     @DataProvider
  40     public static Object[][] classesProvider() {
  41         return new Object[][]{
  42                 {byte.class},
  43                 {short.class},
  44                 {int.class},
  45                 {float.class},
  46                 {long.class},
  47                 {double.class},
  48         };
  49     }
  50 
  51     @Test(dataProvider = "classesProvider")
  52     void testVectorLength(Class<?> c) {
  53         Vector.Species<?> species = null;
  54         if (c == byte.class) {
  55             species = ByteVector.SPECIES_PREFERRED;
  56         } else if (c == short.class) {
  57             species = ShortVector.SPECIES_PREFERRED;
  58         } else if (c == int.class) {
  59             species = IntVector.SPECIES_PREFERRED;
  60         } else if (c == long.class) {
  61             species = LongVector.SPECIES_PREFERRED;
  62         } else if (c == float.class) {
  63             species = FloatVector.SPECIES_PREFERRED;
  64         } else if (c == double.class) {
  65             species = DoubleVector.SPECIES_PREFERRED;
  66         } else {
  67             throw new IllegalArgumentException("Bad vector element type: " + c.getName());
  68         }
  69 
  70         Assert.assertEquals(species.length(), U.getMaxVectorSize(c));
  71     }
  72 }


  33  * @run testng PreferredSpeciesTest
  34  */
  35 
  36 public class PreferredSpeciesTest {
  37     static final Unsafe U = Unsafe.getUnsafe();
  38 
  39     @DataProvider
  40     public static Object[][] classesProvider() {
  41         return new Object[][]{
  42                 {byte.class},
  43                 {short.class},
  44                 {int.class},
  45                 {float.class},
  46                 {long.class},
  47                 {double.class},
  48         };
  49     }
  50 
  51     @Test(dataProvider = "classesProvider")
  52     void testVectorLength(Class<?> c) {
  53         VectorSpecies<?> species = null;
  54         if (c == byte.class) {
  55             species = ByteVector.SPECIES_PREFERRED;
  56         } else if (c == short.class) {
  57             species = ShortVector.SPECIES_PREFERRED;
  58         } else if (c == int.class) {
  59             species = IntVector.SPECIES_PREFERRED;
  60         } else if (c == long.class) {
  61             species = LongVector.SPECIES_PREFERRED;
  62         } else if (c == float.class) {
  63             species = FloatVector.SPECIES_PREFERRED;
  64         } else if (c == double.class) {
  65             species = DoubleVector.SPECIES_PREFERRED;
  66         } else {
  67             throw new IllegalArgumentException("Bad vector element type: " + c.getName());
  68         }
  69 
  70         Assert.assertEquals(species.length(), U.getMaxVectorSize(c));
  71     }
  72 }
< prev index next >