Ejemplo n.º 1
0
        private static void testAllocate()
        {
            // An IllegalArgumentException will be thrown for negative capacities.
            tryCatch((BufferN)null, typeof(IllegalArgumentException), () => { ByteBufferN.allocate(-1); });

            tryCatch((BufferN)null, typeof(IllegalArgumentException), () => { ByteBufferN.allocateDirect(-1); });
        }
Ejemplo n.º 2
0
        public static void test()
        {
            testAllocate();
            test(0, ByteBufferN.allocate(7 * 1024), false);
            test(0, ByteBufferN.wrap(new byte[7 * 1024], 0, 7 * 1024), false);
            test(new byte[1024]);

            ByteBufferN b = ByteBufferN.allocateDirect(7 * 1024);

            for (b.position(0); b.position() < b.limit();)
            {
                ck(b, b.get(), 0);
            }
            test(0, b, true);


            callReset(ByteBufferN.allocate(10));
        }