FindDecoderBugs.java revision 395
395N/A * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. 395N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 395N/A * This code is free software; you can redistribute it and/or modify it 395N/A * under the terms of the GNU General Public License version 2 only, as 395N/A * published by the Free Software Foundation. 395N/A * This code is distributed in the hope that it will be useful, but WITHOUT 395N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 395N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 395N/A * version 2 for more details (a copy is included in the LICENSE file that 395N/A * accompanied this code). 395N/A * You should have received a copy of the GNU General Public License version 395N/A * 2 along with this work; if not, write to the Free Software Foundation, 395N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 395N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 395N/A * CA 95054 USA or visit www.sun.com if you need additional information or 395N/A * @summary Decode many byte sequences in many ways 395N/A * @author Martin Buchholz 395N/A // Some machinery to make sure only a small number of errors 395N/A // that are "too similar" are reported. 395N/A // legend: r=regular d=direct In=Input Ou=Output 395N/A // private static final long maxCharsetFailures = Long.MAX_VALUE; 395N/A bug(
"OVERFLOW, but there's lots of room: %s %s",
395N/A// if (cr.isOverflow() && ib.remaining() == 0) 395N/A// bug("OVERFLOW, yet remaining() == 0: %s %s", 395N/A bug(
"remaining() < CoderResult.length(): %s %s",
395N/A// if (ib.position() == 0 && ob.position() > 0) 395N/A// reporter. bug("output only if input consumed: %s %s", 395N/A // Should we warn if cr.isUnmappable() ?? 395N/A bug(
"Coding operation not idempotent: %s%n %s%n %s",
395N/A if (
bug(
"Unexpected exception: %s %s %s",
395N/A bug(
"Results differ for direct buffers: %s%n %s%n %s",
395N/A bug(
"Expected OVERFLOW: %s%n %s%n %s",
395N/A for (
int i =
0; i <
0x100; i++) {
395N/A for (
int i =
0; i <
10000; i++) {
395N/A for (
int j =
0; j < n; j++)
395N/A // Can you spare a week of CPU time? 395N/A // testExhaustively(cs, tester, prefix, 3); 395N/A private static final byte SS2 = (
byte)
0x8e;
395N/A private static final byte SS3 = (
byte)
0x8f;
395N/A private static final byte ESC = (
byte)
0x1b;
395N/A private static final byte SO = (
byte)
0x0e;
395N/A private static final byte SI = (
byte)
0x0f;
395N/A //--------------------- Infrastructure ---------------------------