@@ -166,14 +166,19 @@ public void testFill() {
166
166
} catch (Throwable th ) {}
167
167
}
168
168
@ Test
169
- public void testCopyTo () {
170
- CLBuffer <Integer > b = context .createIntBuffer (CLMem .Usage .InputOutput , pointerToInts (1 , 2 , 3 , 4 ));
171
- CLBuffer <Integer > out = context .createIntBuffer (CLMem .Usage .InputOutput , 4 );
172
- CLEvent e = b .copyElementsTo (queue , out , 2 , 1 , 2 );
173
- assertArrayEquals (new int [] { 0 , 3 , 4 , 0 }, out .read (queue , e ).getInts ());
174
-
175
- e = b .copyTo (queue , out );
176
- assertArrayEquals (new int [] { 1 , 2 , 3 , 4 }, out .read (queue , e ).getInts ());
169
+ public void testCopyTo_full () {
170
+ CLBuffer <Integer > b = context .createIntBuffer (CLMem .Usage .InputOutput , pointerToInts (1 , 2 , 3 , 4 , 5 , 6 ));
171
+ CLBuffer <Integer > out = context .createIntBuffer (CLMem .Usage .InputOutput , 6 );
172
+
173
+ CLEvent e = b .copyTo (queue , out );
174
+ assertArrayEquals (new int [] { 1 , 2 , 3 , 4 , 5 , 6 }, out .read (queue , e ).getInts ());
177
175
}
176
+ @ Test
177
+ public void testCopyTo_partial () {
178
+ CLBuffer <Integer > b = context .createIntBuffer (CLMem .Usage .InputOutput , pointerToInts (1 , 2 , 3 , 4 , 5 , 6 ));
179
+ CLBuffer <Integer > out = context .createIntBuffer (CLMem .Usage .InputOutput , 6 );
178
180
181
+ CLEvent e = b .copyElementsTo (queue , out , 2 , 1 , 2 );
182
+ assertArrayEquals (new int [] { 3 , 4 }, out .read (queue , e ).next ().validElements (2 ).getInts ());
183
+ }
179
184
}
0 commit comments