< prev index next >

test/jdk/java/foreign/TestReshape.java

Print this page
@@ -25,18 +25,18 @@
   * @test
   * @run testng TestReshape
   */
  
  import jdk.incubator.foreign.MemoryLayout;
- import jdk.incubator.foreign.MemoryLayouts;
  import jdk.incubator.foreign.SequenceLayout;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  import java.util.stream.LongStream;
  
+ import jdk.incubator.foreign.ValueLayout;
  import org.testng.annotations.*;
  import static org.testng.Assert.*;
  
  public class TestReshape {
  

@@ -52,47 +52,47 @@
          }
      }
  
      @Test(expectedExceptions = IllegalArgumentException.class)
      public void testInvalidReshape() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(4, MemoryLayouts.JAVA_INT);
+         SequenceLayout seq = MemoryLayout.sequenceLayout(4, ValueLayout.JAVA_INT);
          seq.reshape(3, 2);
      }
  
      @Test(expectedExceptions = IllegalArgumentException.class)
      public void testBadReshapeInference() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(4, MemoryLayouts.JAVA_INT);
+         SequenceLayout seq = MemoryLayout.sequenceLayout(4, ValueLayout.JAVA_INT);
          seq.reshape(-1, -1);
      }
  
      @Test(expectedExceptions = IllegalArgumentException.class)
      public void testBadReshapeParameterZero() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(4, MemoryLayouts.JAVA_INT);
+         SequenceLayout seq = MemoryLayout.sequenceLayout(4, ValueLayout.JAVA_INT);
          seq.reshape(0, 4);
      }
  
      @Test(expectedExceptions = IllegalArgumentException.class)
      public void testBadReshapeParameterNegative() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(4, MemoryLayouts.JAVA_INT);
+         SequenceLayout seq = MemoryLayout.sequenceLayout(4, ValueLayout.JAVA_INT);
          seq.reshape(-2, 2);
      }
  
      @Test(expectedExceptions = UnsupportedOperationException.class)
      public void testReshapeOnUnboundSequence() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(MemoryLayouts.JAVA_INT);
+         SequenceLayout seq = MemoryLayout.sequenceLayout(ValueLayout.JAVA_INT);
          seq.reshape(3, 2);
      }
  
      @Test(expectedExceptions = UnsupportedOperationException.class)
      public void testFlattenOnUnboundSequence() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(MemoryLayouts.JAVA_INT);
+         SequenceLayout seq = MemoryLayout.sequenceLayout(ValueLayout.JAVA_INT);
          seq.flatten();
      }
  
      @Test(expectedExceptions = UnsupportedOperationException.class)
      public void testFlattenOnUnboundNestedSequence() {
-         SequenceLayout seq = MemoryLayout.sequenceLayout(4, MemoryLayout.sequenceLayout(MemoryLayouts.JAVA_INT));
+         SequenceLayout seq = MemoryLayout.sequenceLayout(4, MemoryLayout.sequenceLayout(ValueLayout.JAVA_INT));
          seq.flatten();
      }
  
      static void assertDimensions(SequenceLayout layout, long... dims) {
          SequenceLayout prev = null;

@@ -123,65 +123,65 @@
              return shapes.iterator();
          }
      }
  
      static MemoryLayout POINT = MemoryLayout.structLayout(
-             MemoryLayouts.JAVA_INT,
-             MemoryLayouts.JAVA_INT
+             ValueLayout.JAVA_INT,
+             ValueLayout.JAVA_INT
      );
  
      @DataProvider(name = "shapes")
      Object[][] shapes() {
          return new Object[][] {
-                 { MemoryLayouts.JAVA_BYTE, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_BYTE, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_BYTE, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_BYTE, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_BYTE, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_BYTE, new long[] { 8, 16, 2 } },
- 
-                 { MemoryLayouts.JAVA_SHORT, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_SHORT, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_SHORT, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_SHORT, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_SHORT, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_SHORT, new long[] { 8, 16, 2 } },
- 
-                 { MemoryLayouts.JAVA_CHAR, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_CHAR, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_CHAR, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_CHAR, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_CHAR, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_CHAR, new long[] { 8, 16, 2 } },
- 
-                 { MemoryLayouts.JAVA_INT, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_INT, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_INT, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_INT, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_INT, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_INT, new long[] { 8, 16, 2 } },
- 
-                 { MemoryLayouts.JAVA_LONG, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_LONG, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_LONG, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_LONG, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_LONG, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_LONG, new long[] { 8, 16, 2 } },
- 
-                 { MemoryLayouts.JAVA_FLOAT, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_FLOAT, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_FLOAT, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_FLOAT, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_FLOAT, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_FLOAT, new long[] { 8, 16, 2 } },
- 
-                 { MemoryLayouts.JAVA_DOUBLE, new long[] { 256 } },
-                 { MemoryLayouts.JAVA_DOUBLE, new long[] { 16, 16 } },
-                 { MemoryLayouts.JAVA_DOUBLE, new long[] { 4, 4, 4, 4 } },
-                 { MemoryLayouts.JAVA_DOUBLE, new long[] { 2, 8, 16 } },
-                 { MemoryLayouts.JAVA_DOUBLE, new long[] { 16, 8, 2 } },
-                 { MemoryLayouts.JAVA_DOUBLE, new long[] { 8, 16, 2 } },
+                 { ValueLayout.JAVA_BYTE, new long[] { 256 } },
+                 { ValueLayout.JAVA_BYTE, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_BYTE, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_BYTE, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_BYTE, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_BYTE, new long[] { 8, 16, 2 } },
+ 
+                 { ValueLayout.JAVA_SHORT, new long[] { 256 } },
+                 { ValueLayout.JAVA_SHORT, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_SHORT, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_SHORT, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_SHORT, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_SHORT, new long[] { 8, 16, 2 } },
+ 
+                 { ValueLayout.JAVA_CHAR, new long[] { 256 } },
+                 { ValueLayout.JAVA_CHAR, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_CHAR, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_CHAR, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_CHAR, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_CHAR, new long[] { 8, 16, 2 } },
+ 
+                 { ValueLayout.JAVA_INT, new long[] { 256 } },
+                 { ValueLayout.JAVA_INT, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_INT, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_INT, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_INT, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_INT, new long[] { 8, 16, 2 } },
+ 
+                 { ValueLayout.JAVA_LONG, new long[] { 256 } },
+                 { ValueLayout.JAVA_LONG, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_LONG, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_LONG, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_LONG, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_LONG, new long[] { 8, 16, 2 } },
+ 
+                 { ValueLayout.JAVA_FLOAT, new long[] { 256 } },
+                 { ValueLayout.JAVA_FLOAT, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_FLOAT, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_FLOAT, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_FLOAT, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_FLOAT, new long[] { 8, 16, 2 } },
+ 
+                 { ValueLayout.JAVA_DOUBLE, new long[] { 256 } },
+                 { ValueLayout.JAVA_DOUBLE, new long[] { 16, 16 } },
+                 { ValueLayout.JAVA_DOUBLE, new long[] { 4, 4, 4, 4 } },
+                 { ValueLayout.JAVA_DOUBLE, new long[] { 2, 8, 16 } },
+                 { ValueLayout.JAVA_DOUBLE, new long[] { 16, 8, 2 } },
+                 { ValueLayout.JAVA_DOUBLE, new long[] { 8, 16, 2 } },
  
                  { POINT, new long[] { 256 } },
                  { POINT, new long[] { 16, 16 } },
                  { POINT, new long[] { 4, 4, 4, 4 } },
                  { POINT, new long[] { 2, 8, 16 } },
< prev index next >