aboutsummaryrefslogtreecommitdiffstats
path: root/test/junit/com/jogamp/common/nio/BuffersTest.java
blob: c5e5758c65c76286e216afa299978c2ada43c7a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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());

    }

}