From e125cd5b1a20221b338cc4f03810b3b8b69004c9 Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Sun, 4 Jul 2010 22:00:26 +0200 Subject: added slice utility methods to Buffers + rudimentary test. --- test/junit/com/jogamp/common/nio/BuffersTest.java | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/junit/com/jogamp/common/nio/BuffersTest.java (limited to 'test/junit') diff --git a/test/junit/com/jogamp/common/nio/BuffersTest.java b/test/junit/com/jogamp/common/nio/BuffersTest.java new file mode 100644 index 0000000..c5e5758 --- /dev/null +++ b/test/junit/com/jogamp/common/nio/BuffersTest.java @@ -0,0 +1,29 @@ +/* + * Created on Sunday, July 04 2010 20:00 + */ +package com.jogamp.common.nio; + +import java.nio.IntBuffer; +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * @author Michael Bien + */ +public class BuffersTest { + + @Test + public void slice() { + IntBuffer buffer = Buffers.newDirectIntBuffer(6); + buffer.put(new int[]{1,2,3,4,5,6}).rewind(); + + IntBuffer threefour = (IntBuffer)Buffers.slice(buffer, 2, 2); + + assertEquals(3, threefour.get(0)); + assertEquals(4, threefour.get(1)); + assertEquals(2, threefour.capacity()); + + } + +} -- cgit v1.2.3