/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* Type-specific source code for unit test
*
* Regenerate the BasicX classes via genBasic.sh whenever this file changes.
* We check in the generated source files so that the test tree can be used
* independently of the rest of the source tree.
*/
// -- This file was mechanically generated: Do not edit! -- //
public class BasicChar
extends Basic
{
private static final char[] VALUES = {
(char) -1,
(char) 0,
(char) 1,
};
int n = b.capacity();
char v;
for (int i = 0; i < n; i++)
b.rewind();
}
int n = b.remaining();
char v;
for (int i = start; i < n; i++)
b.rewind();
}
int n = b.capacity();
char v;
for (int i = 0; i < n; i++)
b.rewind();
}
int n = b.capacity();
char[] a = new char[n + 7];
b.get(a, 7, n);
for (int i = 0; i < n; i++)
}
int n = b.capacity();
b.clear();
for (int i = 0; i < n; i++)
b.flip();
}
int n = b.capacity();
b.clear();
for (int i = 0; i < n; i++)
b.limit(n);
b.position(0);
}
int n = b.capacity();
b.clear();
char[] a = new char[n + 7];
for (int i = 0; i < n; i++)
a[i + 7] = (char)ic(i);
b.put(a, 7, n);
b.flip();
}
int n = b.capacity();
b.clear();
c.position(7);
for (int i = 0; i < n; i++)
c.flip();
c.position(7);
b.put(c);
b.flip();
}
//6231529
b.position(0);
b.mark();
b.asReadOnlyBuffer().reset();
}
// 6221101-6234263
private static void putBuffer() {
final int cap = 10;
}
int n = b.capacity();
b.clear();
for (int i = 0; i < n; i++)
b.flip();
}
}
char x, char y) {
}
boolean caught = false;
try {
} catch (Throwable x) {
caught = true;
} else {
}
}
if (!caught)
}
}
fail("Wrong direction", b);
// Gets and puts
relPut(b);
relGet(b);
absGet(b);
bulkGet(b);
absPut(b);
relGet(b);
absGet(b);
bulkGet(b);
bulkPutArray(b);
relGet(b);
bulkPutBuffer(b);
relGet(b);
bulkPutString(b);
relGet(b);
b.position(1);
b.limit(7);
// CharSequence ops
b.position(2);
// 4938424
b.position(4);
// Compact
relPut(b);
b.position(13);
b.compact();
b.flip();
relGet(b, 13);
// Exceptions
relPut(b);
public void run() {
b.get();
}});
public void run() {
b.put((char)42);
}});
// The index must be non-negative and lesss than the buffer's limit.
public void run() {
}});
public void run() {
b.get(-1);
}});
public void run() {
}});
public void run() {
b.position(0);
b.mark();
b.compact();
b.reset();
}});
// Values
b.clear();
b.put((char)0);
b.put((char)-1);
b.put((char)1);
char v;
b.flip();
// Comparison
b.rewind();
b.position(2);
for (int i = 2; i < b.limit(); i++) {
char x = b.get(i);
if (x != y
)
}
}
b.put((char)99);
b.rewind();
// Check equals and compareTo with interesting values
for (char x : VALUES) {
}
}
for (char y : VALUES) {
fail("compareTo not anti-symmetric",
}
fail("compareTo inconsistent with equals",
}
fail("Incorrect results for CharBuffer.compareTo",
}
fail("Incorrect results for CharBuffer.equals",
}
}
}
// Sub, dup
relPut(b);
b.position(13);
// Slice
b.position(5);
checkSlice(b, sb);
b.position(0);
fail("Array offsets do not match: "
// Read-only views
b.rewind();
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
rb.arrayOffset();
}});
fail("Read-only heap buffer's backing array is accessible",
rb);
}
// Bulk puts from read-only buffers
b.clear();
relPut(b); // Required by testViews
}
private static void testStr() {
final String s = "abcdefghijklm";
int start = 3;
int end = 9;
show(0, b);
ck(b, b.isReadOnly());
public void run() {
b.put('x');
}});
b.position(6);
// The index, relative to the position, must be non-negative and
// smaller than remaining().
public void run() {
b.charAt(-1);
}});
public void run() {
}});
// The index must be non-negative and less than the buffer's limit.
public void run() {
}});
public void run() {
b.get(-1);
}});
// The start must be non-negative and no larger than remaining().
public void run() {
}});
public void run() {
}});
// The end must be no smaller than start and no larger than
// remaining().
public void run() {
}});
public void run() {
}});
// The offset must be non-negative and no larger than <array.length>.
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
}
int offset = 47;
int length = 900;
show(0, b);
// The offset must be non-negative and no larger than <array.length>.
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
// A NullPointerException will be thrown if the array is null.
public void run() {
}});
public void run() {
}});
}
private static void testAllocate() {
// An IllegalArgumentException will be thrown for negative capacities.
public void run() {
}});
}
public static void test() {
testAllocate();
test(new char[1024]);
testStr();
putBuffer();
}
}