Enforce line length and indent in checkstyle (#1448)

This commit is contained in:
Sean Owen 2021-10-05 15:49:47 -05:00 committed by GitHub
parent fc50fca12f
commit b51346c072
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
72 changed files with 1011 additions and 901 deletions

View file

@ -288,8 +288,8 @@ public class IntentIntegrator {
} }
/** /**
* Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings corresponding * Initiates a scan, using the specified camera, only for a certain set of barcode types, given as strings
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants * corresponding to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
* like {@link #PRODUCT_CODE_TYPES} for example. * like {@link #PRODUCT_CODE_TYPES} for example.
* *
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for * @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for

View file

@ -35,8 +35,8 @@ import java.util.HashSet;
public final class HttpHelper { public final class HttpHelper {
private static final Collection<String> REDIRECTOR_DOMAINS = new HashSet<>(Arrays.asList( private static final Collection<String> REDIRECTOR_DOMAINS = new HashSet<>(Arrays.asList(
"amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly", "amzn.to", "bit.ly", "bitly.com", "fb.me", "goo.gl", "is.gd", "j.mp", "lnkd.in", "ow.ly",
"R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im" "R.BEETAGG.COM", "r.beetagg.com", "SCN.BY", "su.pr", "t.co", "tinyurl.com", "tr.im"
)); ));
private HttpHelper() { private HttpHelper() {
@ -182,7 +182,7 @@ public final class HttpHelper {
connection.disconnect(); connection.disconnect();
} }
} }
private static HttpURLConnection safelyOpenConnection(URL url) throws IOException { private static HttpURLConnection safelyOpenConnection(URL url) throws IOException {
URLConnection conn; URLConnection conn;
try { try {

View file

@ -30,10 +30,10 @@ final class SearchBookContentsResult {
private final String snippet; private final String snippet;
private final boolean validSnippet; private final boolean validSnippet;
SearchBookContentsResult(String pageId, SearchBookContentsResult(String pageId,
String pageNumber, String pageNumber,
String snippet, String snippet,
boolean validSnippet) { boolean validSnippet) {
this.pageId = pageId; this.pageId = pageId;
this.pageNumber = pageNumber; this.pageNumber = pageNumber;
this.snippet = snippet; this.snippet = snippet;

View file

@ -174,7 +174,8 @@ public abstract class ResultHandler {
} }
final void addPhoneOnlyContact(String[] phoneNumbers,String[] phoneTypes) { final void addPhoneOnlyContact(String[] phoneNumbers,String[] phoneTypes) {
addContact(null, null, null, phoneNumbers, phoneTypes, null, null, null, null, null, null, null, null, null, null, null); addContact(null, null, null, phoneNumbers, phoneTypes,
null, null, null, null, null, null, null, null, null, null, null);
} }
final void addEmailOnlyContact(String[] emails, String[] emailTypes) { final void addEmailOnlyContact(String[] emails, String[] emailTypes) {

View file

@ -61,7 +61,8 @@ public final class WifiResultHandler extends ResultHandler {
public void handleButtonPress(int index) { public void handleButtonPress(int index) {
if (index == 0) { if (index == 0) {
WifiParsedResult wifiResult = (WifiParsedResult) getResult(); WifiParsedResult wifiResult = (WifiParsedResult) getResult();
WifiManager wifiManager = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiManager wifiManager =
(WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (wifiManager == null) { if (wifiManager == null) {
Log.w(TAG, "No WifiManager available from device"); Log.w(TAG, "No WifiManager available from device");
return; return;
@ -89,4 +90,4 @@ public final class WifiResultHandler extends ResultHandler {
public int getDisplayTitle() { public int getDisplayTitle() {
return R.string.result_wifi; return R.string.result_wifi;
} }
} }

View file

@ -256,18 +256,18 @@ public final class WifiConfigManager extends AsyncTask<WifiParsedResult,Object,O
return WifiEnterpriseConfig.Eap.NONE; return WifiEnterpriseConfig.Eap.NONE;
} }
switch (eapString) { switch (eapString) {
case "NONE": case "NONE":
return WifiEnterpriseConfig.Eap.NONE; return WifiEnterpriseConfig.Eap.NONE;
case "PEAP": case "PEAP":
return WifiEnterpriseConfig.Eap.PEAP; return WifiEnterpriseConfig.Eap.PEAP;
case "PWD": case "PWD":
return WifiEnterpriseConfig.Eap.PWD; return WifiEnterpriseConfig.Eap.PWD;
case "TLS": case "TLS":
return WifiEnterpriseConfig.Eap.TLS; return WifiEnterpriseConfig.Eap.TLS;
case "TTLS": case "TTLS":
return WifiEnterpriseConfig.Eap.TTLS; return WifiEnterpriseConfig.Eap.TTLS;
default: default:
throw new IllegalArgumentException("Unknown value for EAP method: " + eapString); throw new IllegalArgumentException("Unknown value for EAP method: " + eapString);
} }
} }
@ -276,18 +276,18 @@ public final class WifiConfigManager extends AsyncTask<WifiParsedResult,Object,O
return WifiEnterpriseConfig.Phase2.NONE; return WifiEnterpriseConfig.Phase2.NONE;
} }
switch (phase2String) { switch (phase2String) {
case "GTC": case "GTC":
return WifiEnterpriseConfig.Phase2.GTC; return WifiEnterpriseConfig.Phase2.GTC;
case "MSCHAP": case "MSCHAP":
return WifiEnterpriseConfig.Phase2.MSCHAP; return WifiEnterpriseConfig.Phase2.MSCHAP;
case "MSCHAPV2": case "MSCHAPV2":
return WifiEnterpriseConfig.Phase2.MSCHAPV2; return WifiEnterpriseConfig.Phase2.MSCHAPV2;
case "NONE": case "NONE":
return WifiEnterpriseConfig.Phase2.NONE; return WifiEnterpriseConfig.Phase2.NONE;
case "PAP": case "PAP":
return WifiEnterpriseConfig.Phase2.PAP; return WifiEnterpriseConfig.Phase2.PAP;
default: default:
throw new IllegalArgumentException("Unknown value for phase 2 method: " + phase2String); throw new IllegalArgumentException("Unknown value for phase 2 method: " + phase2String);
} }
} }

View file

@ -51,7 +51,7 @@ public final class Dimension {
@Override @Override
public int hashCode() { public int hashCode() {
return width * 32713 + height; return width * 32713 + height;
} }
@Override @Override

View file

@ -117,7 +117,8 @@ public enum EncodeHintType {
GS1_FORMAT, GS1_FORMAT,
/** /**
* Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}). Valid values are "A", "B", "C". * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
* Valid values are "A", "B", "C".
*/ */
FORCE_CODE_SET, FORCE_CODE_SET,
} }

View file

@ -129,10 +129,10 @@ public final class MultiFormatReader implements Reader {
readers.add(new AztecReader()); readers.add(new AztecReader());
} }
if (formats.contains(BarcodeFormat.PDF_417)) { if (formats.contains(BarcodeFormat.PDF_417)) {
readers.add(new PDF417Reader()); readers.add(new PDF417Reader());
} }
if (formats.contains(BarcodeFormat.MAXICODE)) { if (formats.contains(BarcodeFormat.MAXICODE)) {
readers.add(new MaxiCodeReader()); readers.add(new MaxiCodeReader());
} }
// At end in "try harder" mode // At end in "try harder" mode
if (addOneDReader && tryHarder) { if (addOneDReader && tryHarder) {

View file

@ -96,7 +96,8 @@ public enum ResultMetadataType {
/** /**
* Barcode Symbology Identifier. * Barcode Symbology Identifier.
* Note: According to the GS1 specification the identifier may have to replace a leading FNC1/GS character when prepending to the barcode content. * Note: According to the GS1 specification the identifier may have to replace a leading FNC1/GS character
* when prepending to the barcode content.
*/ */
SYMBOLOGY_IDENTIFIER, SYMBOLOGY_IDENTIFIER,
} }

View file

@ -84,7 +84,8 @@ public final class Decoder {
CorrectedBitsResult correctedBits = correctBits(rawbits); CorrectedBitsResult correctedBits = correctBits(rawbits);
byte[] rawBytes = convertBoolArrayToByteArray(correctedBits.correctBits); byte[] rawBytes = convertBoolArrayToByteArray(correctedBits.correctBits);
String result = getEncodedData(correctedBits.correctBits); String result = getEncodedData(correctedBits.correctBits);
DecoderResult decoderResult = new DecoderResult(rawBytes, result, null, String.format("%d%%", correctedBits.ecLevel)); DecoderResult decoderResult =
new DecoderResult(rawBytes, result, null, String.format("%d%%", correctedBits.ecLevel));
decoderResult.setNumBits(correctedBits.correctBits.length); decoderResult.setNumBits(correctedBits.correctBits.length);
return decoderResult; return decoderResult;
} }

View file

@ -66,7 +66,7 @@ public final class Detector {
* @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code * @return {@link AztecDetectorResult} encapsulating results of detecting an Aztec Code
* @throws NotFoundException if no Aztec Code can be found * @throws NotFoundException if no Aztec Code can be found
*/ */
public AztecDetectorResult detect(boolean isMirror) throws NotFoundException { public AztecDetectorResult detect(boolean isMirror) throws NotFoundException {
// 1. Get the center of the aztec matrix // 1. Get the center of the aztec matrix
Point pCenter = getMatrixCenter(); Point pCenter = getMatrixCenter();

View file

@ -129,8 +129,8 @@ final class State {
mode = HighLevelEncoder.MODE_UPPER; mode = HighLevelEncoder.MODE_UPPER;
} }
int deltaBitCount = int deltaBitCount =
(binaryShiftByteCount == 0 || binaryShiftByteCount == 31) ? 18 : (binaryShiftByteCount == 0 || binaryShiftByteCount == 31) ? 18 :
(binaryShiftByteCount == 62) ? 9 : 8; (binaryShiftByteCount == 62) ? 9 : 8;
State result = new State(token, mode, binaryShiftByteCount + 1, bitCount + deltaBitCount); State result = new State(token, mode, binaryShiftByteCount + 1, bitCount + deltaBitCount);
if (result.binaryShiftByteCount == 2047 + 31) { if (result.binaryShiftByteCount == 2047 + 31) {
// The string is as long as it's allowed to be. We should end it. // The string is as long as it's allowed to be. We should end it.

View file

@ -34,7 +34,7 @@ abstract class Token {
final Token add(int value, int bitCount) { final Token add(int value, int bitCount) {
return new SimpleToken(this, value, bitCount); return new SimpleToken(this, value, bitCount);
} }
final Token addBinaryShift(int start, int byteCount) { final Token addBinaryShift(int start, int byteCount) {
//int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21); //int bitCount = (byteCount * 8) + (byteCount <= 31 ? 10 : byteCount <= 62 ? 20 : 21);

View file

@ -40,7 +40,14 @@ public final class WifiParsedResult extends ParsedResult {
this(networkEncryption, ssid, password, hidden, null, null, null, null); this(networkEncryption, ssid, password, hidden, null, null, null, null);
} }
public WifiParsedResult(String networkEncryption, String ssid, String password, boolean hidden, String identity, String anonymousIdentity, String eapMethod, String phase2Method) { public WifiParsedResult(String networkEncryption,
String ssid,
String password,
boolean hidden,
String identity,
String anonymousIdentity,
String eapMethod,
String phase2Method) {
super(ParsedResultType.WIFI); super(ParsedResultType.WIFI);
this.ssid = ssid; this.ssid = ssid;
this.networkEncryption = networkEncryption; this.networkEncryption = networkEncryption;
@ -94,4 +101,4 @@ public final class WifiParsedResult extends ParsedResult {
return result.toString(); return result.toString();
} }
} }

View file

@ -18,6 +18,7 @@ package com.google.zxing.client.result;
import com.google.zxing.Result; import com.google.zxing.Result;
@SuppressWarnings("checkstyle:lineLength")
/** /**
* <p>Parses a WIFI configuration string. Strings will be of the form:</p> * <p>Parses a WIFI configuration string. Strings will be of the form:</p>
* *

View file

@ -462,7 +462,7 @@ public final class BitMatrix implements Cloneable {
hash = 31 * hash + width; hash = 31 * hash + width;
hash = 31 * hash + height; hash = 31 * hash + height;
hash = 31 * hash + rowSize; hash = 31 * hash + rowSize;
hash = 31 * hash + Arrays.hashCode(bits); hash = 31 * hash + Arrays.hashCode(bits);
return hash; return hash;
} }

View file

@ -52,15 +52,15 @@ public final class StringUtils {
* of these can possibly be correct * of these can possibly be correct
*/ */
public static String guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints) { public static String guessEncoding(byte[] bytes, Map<DecodeHintType,?> hints) {
Charset c = guessCharset(bytes, hints); Charset c = guessCharset(bytes, hints);
if (c == SHIFT_JIS_CHARSET) { if (c == SHIFT_JIS_CHARSET) {
return "SJIS"; return "SJIS";
} else if (c == StandardCharsets.UTF_8) { } else if (c == StandardCharsets.UTF_8) {
return "UTF8"; return "UTF8";
} else if (c == StandardCharsets.ISO_8859_1) { } else if (c == StandardCharsets.ISO_8859_1) {
return "ISO8859_1"; return "ISO8859_1";
} }
return c.name(); return c.name();
} }
/** /**

View file

@ -89,7 +89,8 @@ public final class DataMatrixWriter implements Writer {
String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo); String codewords = ErrorCorrection.encodeECC200(encoded, symbolInfo);
//3. step: Module placement in Matrix //3. step: Module placement in Matrix
DefaultPlacement placement = new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight()); DefaultPlacement placement =
new DefaultPlacement(codewords, symbolInfo.getSymbolDataWidth(), symbolInfo.getSymbolDataHeight());
placement.place(); placement.place();
//4. step: low-level encoding //4. step: low-level encoding

View file

@ -126,7 +126,7 @@ final class BitMatrixParser {
// Sweep downward diagonally to the left // Sweep downward diagonally to the left
do { do {
if ((row >= 0) && (column < numColumns) && !readMappingMatrix.get(column, row)) { if ((row >= 0) && (column < numColumns) && !readMappingMatrix.get(column, row)) {
result[resultOffset++] = (byte) readUtah(row, column, numRows, numColumns); result[resultOffset++] = (byte) readUtah(row, column, numRows, numColumns);
} }
row += 2; row += 2;
column -= 2; column -= 2;

View file

@ -52,7 +52,7 @@ final class DataBlock {
int totalBlocks = 0; int totalBlocks = 0;
Version.ECB[] ecBlockArray = ecBlocks.getECBlocks(); Version.ECB[] ecBlockArray = ecBlocks.getECBlocks();
for (Version.ECB ecBlock : ecBlockArray) { for (Version.ECB ecBlock : ecBlockArray) {
totalBlocks += ecBlock.getCount(); totalBlocks += ecBlock.getCount();
} }
// Now establish DataBlocks of the appropriate size and number of data codewords // Now establish DataBlocks of the appropriate size and number of data codewords

View file

@ -91,7 +91,8 @@ final class DecodedBitStreamParser {
StringBuilder resultTrailer = new StringBuilder(0); StringBuilder resultTrailer = new StringBuilder(0);
List<byte[]> byteSegments = new ArrayList<>(1); List<byte[]> byteSegments = new ArrayList<>(1);
Mode mode = Mode.ASCII_ENCODE; Mode mode = Mode.ASCII_ENCODE;
Set<Integer> fnc1Positions = new HashSet<>(); // Would be replaceable by looking directly at 'bytes', if we're sure to not having to account for multi byte values. // Could look directly at 'bytes', if we're sure of not having to account for multi byte values
Set<Integer> fnc1Positions = new HashSet<>();
int symbologyModifier; int symbologyModifier;
boolean isECIencoded = false; boolean isECIencoded = false;
do { do {
@ -146,7 +147,11 @@ final class DecodedBitStreamParser {
} }
} }
return new DecoderResult(bytes, result.toString(), byteSegments.isEmpty() ? null : byteSegments, null, symbologyModifier); return new DecoderResult(bytes,
result.toString(),
byteSegments.isEmpty() ? null : byteSegments,
null,
symbologyModifier);
} }
/** /**
@ -226,7 +231,8 @@ final class DecodedBitStreamParser {
/** /**
* See ISO 16022:2006, 5.2.5 and Annex C, Table C.1 * See ISO 16022:2006, 5.2.5 and Annex C, Table C.1
*/ */
private static void decodeC40Segment(BitSource bits, StringBuilder result, Set<Integer> fnc1positions) throws FormatException { private static void decodeC40Segment(BitSource bits, StringBuilder result, Set<Integer> fnc1positions)
throws FormatException {
// Three C40 values are encoded in a 16-bit value as // Three C40 values are encoded in a 16-bit value as
// (1600 * C1) + (40 * C2) + C3 + 1 // (1600 * C1) + (40 * C2) + C3 + 1
// TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time // TODO(bbrown): The Upper Shift with C40 doesn't work in the 4 value scenario all the time
@ -317,7 +323,8 @@ final class DecodedBitStreamParser {
/** /**
* See ISO 16022:2006, 5.2.6 and Annex C, Table C.2 * See ISO 16022:2006, 5.2.6 and Annex C, Table C.2
*/ */
private static void decodeTextSegment(BitSource bits, StringBuilder result, Set<Integer> fnc1positions) throws FormatException { private static void decodeTextSegment(BitSource bits, StringBuilder result, Set<Integer> fnc1positions)
throws FormatException {
// Three Text values are encoded in a 16-bit value as // Three Text values are encoded in a 16-bit value as
// (1600 * C1) + (40 * C2) + C3 + 1 // (1600 * C1) + (40 * C2) + C3 + 1
// TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time // TODO(bbrown): The Upper Shift with Text doesn't work in the 4 value scenario all the time

View file

@ -219,11 +219,11 @@ public final class Detector {
trRight = transitionsBetween(pointCs, pointD); trRight = transitionsBetween(pointCs, pointD);
ResultPoint candidate1 = new ResultPoint( ResultPoint candidate1 = new ResultPoint(
pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1), pointD.getX() + (pointC.getX() - pointB.getX()) / (trTop + 1),
pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1)); pointD.getY() + (pointC.getY() - pointB.getY()) / (trTop + 1));
ResultPoint candidate2 = new ResultPoint( ResultPoint candidate2 = new ResultPoint(
pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1), pointD.getX() + (pointA.getX() - pointB.getX()) / (trRight + 1),
pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1)); pointD.getY() + (pointA.getY() - pointB.getY()) / (trRight + 1));
if (!isValid(candidate1)) { if (!isValid(candidate1)) {
if (isValid(candidate2)) { if (isValid(candidate2)) {

View file

@ -103,8 +103,8 @@ public final class MaxiCodeReader implements Reader {
// srowen: I don't quite understand why the formula below is necessary, but it // srowen: I don't quite understand why the formula below is necessary, but it
// can walk off the image if left + width = the right boundary. So cap it. // can walk off the image if left + width = the right boundary. So cap it.
int ix = left + Math.min( int ix = left + Math.min(
(x * width + width / 2 + (y & 0x01) * width / 2) / MATRIX_WIDTH, (x * width + width / 2 + (y & 0x01) * width / 2) / MATRIX_WIDTH,
width - 1); width - 1);
if (image.get(ix, iy)) { if (image.get(ix, iy)) {
bits.set(x, y); bits.set(x, y);
} }

View file

@ -24,6 +24,7 @@ import com.google.zxing.common.BitMatrix;
*/ */
final class BitMatrixParser { final class BitMatrixParser {
@SuppressWarnings("checkstyle:lineLength")
private static final int[][] BITNR = { private static final int[][] BITNR = {
{121,120,127,126,133,132,139,138,145,144,151,150,157,156,163,162,169,168,175,174,181,180,187,186,193,192,199,198, -2, -2}, {121,120,127,126,133,132,139,138,145,144,151,150,157,156,163,162,169,168,175,174,181,180,187,186,193,192,199,198, -2, -2},
{123,122,129,128,135,134,141,140,147,146,153,152,159,158,165,164,171,170,177,176,183,182,189,188,195,194,201,200,816, -3}, {123,122,129,128,135,134,141,140,147,146,153,152,159,158,165,164,171,170,177,176,183,182,189,188,195,194,201,200,816, -3},

View file

@ -46,6 +46,7 @@ final class DecodedBitStreamParser {
private static final char GS = '\u001D'; private static final char GS = '\u001D';
private static final char RS = '\u001E'; private static final char RS = '\u001E';
@SuppressWarnings("checkstyle:lineLength")
private static final String[] SETS = { private static final String[] SETS = {
"\nABCDEFGHIJKLMNOPQRSTUVWXYZ" + ECI + FS + GS + RS + NS + ' ' + PAD + "\nABCDEFGHIJKLMNOPQRSTUVWXYZ" + ECI + FS + GS + RS + NS + ' ' + PAD +
"\"#$%&'()*+,-./0123456789:" + SHIFTB + SHIFTC + SHIFTD + SHIFTE + LATCHB, "\"#$%&'()*+,-./0123456789:" + SHIFTB + SHIFTC + SHIFTD + SHIFTE + LATCHB,

View file

@ -130,7 +130,7 @@ public final class MultiFinderPatternFinder extends FinderPatternFinder {
* So, if the layout seems right, lets have the decoder try to decode. * So, if the layout seems right, lets have the decoder try to decode.
*/ */
List<FinderPattern[]> results = new ArrayList<>(); // holder for the results List<FinderPattern[]> results = new ArrayList<>(); // holder for the results
for (int i1 = 0; i1 < (size - 2); i1++) { for (int i1 = 0; i1 < (size - 2); i1++) {
FinderPattern p1 = possibleCenters.get(i1); FinderPattern p1 = possibleCenters.get(i1);

View file

@ -285,10 +285,10 @@ public final class Code128Writer extends OneDimensionalCodeWriter {
private static int chooseCode(CharSequence value, int start, int oldCode) { private static int chooseCode(CharSequence value, int start, int oldCode) {
CType lookahead = findCType(value, start); CType lookahead = findCType(value, start);
if (lookahead == CType.ONE_DIGIT) { if (lookahead == CType.ONE_DIGIT) {
if (oldCode == CODE_CODE_A) { if (oldCode == CODE_CODE_A) {
return CODE_CODE_A; return CODE_CODE_A;
} }
return CODE_CODE_B; return CODE_CODE_B;
} }
if (lookahead == CType.UNCODABLE) { if (lookahead == CType.UNCODABLE) {
if (start < value.length()) { if (start < value.length()) {

View file

@ -48,8 +48,8 @@ public final class Code39Writer extends OneDimensionalCodeWriter {
contents = tryToConvertToExtendedMode(contents); contents = tryToConvertToExtendedMode(contents);
length = contents.length(); length = contents.length();
if (length > 80) { if (length > 80) {
throw new IllegalArgumentException( throw new IllegalArgumentException("Requested contents should be less than 80 digits long, but got " +
"Requested contents should be less than 80 digits long, but got " + length + " (extended full ASCII mode)"); length + " (extended full ASCII mode)");
} }
break; break;
} }
@ -82,57 +82,57 @@ public final class Code39Writer extends OneDimensionalCodeWriter {
} }
private static String tryToConvertToExtendedMode(String contents) { private static String tryToConvertToExtendedMode(String contents) {
int length = contents.length(); int length = contents.length();
StringBuilder extendedContent = new StringBuilder(); StringBuilder extendedContent = new StringBuilder();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
char character = contents.charAt(i); char character = contents.charAt(i);
switch (character) { switch (character) {
case '\u0000': case '\u0000':
extendedContent.append("%U"); extendedContent.append("%U");
break; break;
case ' ': case ' ':
case '-': case '-':
case '.': case '.':
extendedContent.append(character); extendedContent.append(character);
break; break;
case '@': case '@':
extendedContent.append("%V"); extendedContent.append("%V");
break; break;
case '`': case '`':
extendedContent.append("%W"); extendedContent.append("%W");
break; break;
default: default:
if (character <= 26) { if (character <= 26) {
extendedContent.append('$'); extendedContent.append('$');
extendedContent.append((char) ('A' + (character - 1))); extendedContent.append((char) ('A' + (character - 1)));
} else if (character < ' ') { } else if (character < ' ') {
extendedContent.append('%'); extendedContent.append('%');
extendedContent.append((char) ('A' + (character - 27))); extendedContent.append((char) ('A' + (character - 27)));
} else if (character <= ',' || character == '/' || character == ':') { } else if (character <= ',' || character == '/' || character == ':') {
extendedContent.append('/'); extendedContent.append('/');
extendedContent.append((char) ('A' + (character - 33))); extendedContent.append((char) ('A' + (character - 33)));
} else if (character <= '9') { } else if (character <= '9') {
extendedContent.append((char) ('0' + (character - 48))); extendedContent.append((char) ('0' + (character - 48)));
} else if (character <= '?') { } else if (character <= '?') {
extendedContent.append('%'); extendedContent.append('%');
extendedContent.append((char) ('F' + (character - 59))); extendedContent.append((char) ('F' + (character - 59)));
} else if (character <= 'Z') { } else if (character <= 'Z') {
extendedContent.append((char) ('A' + (character - 65))); extendedContent.append((char) ('A' + (character - 65)));
} else if (character <= '_') { } else if (character <= '_') {
extendedContent.append('%'); extendedContent.append('%');
extendedContent.append((char) ('K' + (character - 91))); extendedContent.append((char) ('K' + (character - 91)));
} else if (character <= 'z') { } else if (character <= 'z') {
extendedContent.append('+'); extendedContent.append('+');
extendedContent.append((char) ('A' + (character - 97))); extendedContent.append((char) ('A' + (character - 97)));
} else if (character <= 127) { } else if (character <= 127) {
extendedContent.append('%'); extendedContent.append('%');
extendedContent.append((char) ('P' + (character - 123))); extendedContent.append((char) ('P' + (character - 123)));
} else { } else {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Requested content contains a non-encodable character: '" + contents.charAt(i) + "'"); "Requested content contains a non-encodable character: '" + contents.charAt(i) + "'");
} }
break; break;
} }
} }
return extendedContent.toString(); return extendedContent.toString();

View file

@ -39,8 +39,8 @@ public class Code93Writer extends OneDimensionalCodeWriter {
contents = convertToExtended(contents); contents = convertToExtended(contents);
int length = contents.length(); int length = contents.length();
if (length > 80) { if (length > 80) {
throw new IllegalArgumentException( throw new IllegalArgumentException("Requested contents should be less than 80 digits long after " +
"Requested contents should be less than 80 digits long after converting to extended encoding, but got " + length); "converting to extended encoding, but got " + length);
} }
//length of code + 2 start/stop characters + 2 checksums, each of 9 bits, plus a termination bar //length of code + 2 start/stop characters + 2 checksums, each of 9 bits, plus a termination bar

View file

@ -64,13 +64,13 @@ public final class MultiFormatOneDReader extends OneDReader {
readers.add(new Code128Reader()); readers.add(new Code128Reader());
} }
if (possibleFormats.contains(BarcodeFormat.ITF)) { if (possibleFormats.contains(BarcodeFormat.ITF)) {
readers.add(new ITFReader()); readers.add(new ITFReader());
} }
if (possibleFormats.contains(BarcodeFormat.CODABAR)) { if (possibleFormats.contains(BarcodeFormat.CODABAR)) {
readers.add(new CodaBarReader()); readers.add(new CodaBarReader());
} }
if (possibleFormats.contains(BarcodeFormat.RSS_14)) { if (possibleFormats.contains(BarcodeFormat.RSS_14)) {
readers.add(new RSS14Reader()); readers.add(new RSS14Reader());
} }
if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)) { if (possibleFormats.contains(BarcodeFormat.RSS_EXPANDED)) {
readers.add(new RSSExpandedReader()); readers.add(new RSSExpandedReader());

View file

@ -160,7 +160,7 @@ public final class RSS14Reader extends AbstractRSSReader {
FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd); FinderPattern pattern = parseFoundFinderPattern(row, rowNumber, right, startEnd);
ResultPointCallback resultPointCallback = hints == null ? null : ResultPointCallback resultPointCallback = hints == null ? null :
(ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK); (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);
if (resultPointCallback != null) { if (resultPointCallback != null) {
startEnd = pattern.getStartEnd(); startEnd = pattern.getStartEnd();

View file

@ -101,6 +101,7 @@ public final class RSSExpandedReader extends AbstractRSSReader {
private static final int FINDER_PAT_E = 4; private static final int FINDER_PAT_E = 4;
private static final int FINDER_PAT_F = 5; private static final int FINDER_PAT_F = 5;
@SuppressWarnings("checkstyle:lineLength")
private static final int[][] FINDER_PATTERN_SEQUENCES = { private static final int[][] FINDER_PATTERN_SEQUENCES = {
{ FINDER_PAT_A, FINDER_PAT_A }, { FINDER_PAT_A, FINDER_PAT_A },
{ FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B }, { FINDER_PAT_A, FINDER_PAT_B, FINDER_PAT_B },

View file

@ -60,7 +60,7 @@ final class AI01393xDecoder extends AI01decoder {
buf.append(')'); buf.append(')');
int firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray( int firstThreeDigits = this.getGeneralDecoder().extractNumericValueFromBitArray(
HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, FIRST_THREE_DIGITS_SIZE); HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE, FIRST_THREE_DIGITS_SIZE);
if (firstThreeDigits / 100 == 0) { if (firstThreeDigits / 100 == 0) {
buf.append('0'); buf.append('0');
} }
@ -70,7 +70,7 @@ final class AI01393xDecoder extends AI01decoder {
buf.append(firstThreeDigits); buf.append(firstThreeDigits);
DecodedInformation generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField( DecodedInformation generalInformation = this.getGeneralDecoder().decodeGeneralPurposeField(
HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE + FIRST_THREE_DIGITS_SIZE, null); HEADER_SIZE + GTIN_SIZE + LAST_DIGIT_SIZE + FIRST_THREE_DIGITS_SIZE, null);
buf.append(generalInformation.getNewString()); buf.append(generalInformation.getNewString());
return buf.toString(); return buf.toString();

View file

@ -60,7 +60,7 @@ abstract class AI01decoder extends AbstractExpandedDecoder {
buf.append(currentBlock); buf.append(currentBlock);
} }
appendCheckDigit(buf, initialBufferPosition); appendCheckDigit(buf, initialBufferPosition);
} }
private static void appendCheckDigit(StringBuilder buf, int currentPos) { private static void appendCheckDigit(StringBuilder buf, int currentPos) {

View file

@ -273,7 +273,8 @@ final class DecodedBitStreamParser {
// do not include terminator // do not include terminator
optionalFieldsLength--; optionalFieldsLength--;
} }
resultMetadata.setOptionalData(Arrays.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength)); resultMetadata.setOptionalData(
Arrays.copyOfRange(codewords, optionalFieldsStart, optionalFieldsStart + optionalFieldsLength));
} }
return codeIndex; return codeIndex;

View file

@ -130,7 +130,9 @@ final class DetectionResult {
} }
int rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber(); int rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
int invalidRowCounts = 0; int invalidRowCounts = 0;
for (int barcodeColumn = barcodeColumnCount + 1; barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn--) { for (int barcodeColumn = barcodeColumnCount + 1;
barcodeColumn > 0 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP;
barcodeColumn--) {
Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow]; Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
if (codeword != null) { if (codeword != null) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword); invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);
@ -155,7 +157,9 @@ final class DetectionResult {
} }
int rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber(); int rowIndicatorRowNumber = codewords[codewordsRow].getRowNumber();
int invalidRowCounts = 0; int invalidRowCounts = 0;
for (int barcodeColumn = 1; barcodeColumn < barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP; barcodeColumn++) { for (int barcodeColumn = 1;
barcodeColumn < barcodeColumnCount + 1 && invalidRowCounts < ADJUST_ROW_NUMBER_SKIP;
barcodeColumn++) {
Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow]; Codeword codeword = detectionResultColumns[barcodeColumn].getCodewords()[codewordsRow];
if (codeword != null) { if (codeword != null) {
invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword); invalidRowCounts = adjustRowNumberIfValid(rowIndicatorRowNumber, invalidRowCounts, codeword);

View file

@ -199,8 +199,10 @@ final class DetectionResultRowIndicatorColumn extends DetectionResultColumn {
(barcodeRowCountLowerPart.getValue().length == 0) || (barcodeRowCountLowerPart.getValue().length == 0) ||
(barcodeECLevel.getValue().length == 0) || (barcodeECLevel.getValue().length == 0) ||
barcodeColumnCount.getValue()[0] < 1 || barcodeColumnCount.getValue()[0] < 1 ||
barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] < PDF417Common.MIN_ROWS_IN_BARCODE || barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] <
barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] > PDF417Common.MAX_ROWS_IN_BARCODE) { PDF417Common.MIN_ROWS_IN_BARCODE ||
barcodeRowCountUpperPart.getValue()[0] + barcodeRowCountLowerPart.getValue()[0] >
PDF417Common.MAX_ROWS_IN_BARCODE) {
return null; return null;
} }
BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0], BarcodeMetadata barcodeMetadata = new BarcodeMetadata(barcodeColumnCount.getValue()[0],

View file

@ -55,7 +55,8 @@ public final class PDF417ScanningDecoder {
ResultPoint imageTopRight, ResultPoint imageTopRight,
ResultPoint imageBottomRight, ResultPoint imageBottomRight,
int minCodewordWidth, int minCodewordWidth,
int maxCodewordWidth) throws NotFoundException, FormatException, ChecksumException { int maxCodewordWidth)
throws NotFoundException, FormatException, ChecksumException {
BoundingBox boundingBox = new BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight); BoundingBox boundingBox = new BoundingBox(image, imageTopLeft, imageBottomLeft, imageTopRight, imageBottomRight);
DetectionResultRowIndicatorColumn leftRowIndicatorColumn = null; DetectionResultRowIndicatorColumn leftRowIndicatorColumn = null;
DetectionResultRowIndicatorColumn rightRowIndicatorColumn = null; DetectionResultRowIndicatorColumn rightRowIndicatorColumn = null;

View file

@ -52,8 +52,9 @@ public final class Detector {
// if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged. // if we set the value too low, then we don't detect the correct height of the bar if the start patterns are damaged.
// if we set the value too high, then we might detect the start pattern from a neighbor barcode. // if we set the value too high, then we might detect the start pattern from a neighbor barcode.
private static final int SKIPPED_ROW_COUNT_MAX = 25; private static final int SKIPPED_ROW_COUNT_MAX = 25;
// A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width. Therefore it should be at least // A PDF471 barcode should have at least 3 rows, with each row being >= 3 times the module width.
// 9 pixels tall. To be conservative, we use about half the size to ensure we don't miss it. // Therefore it should be at least 9 pixels tall. To be conservative, we use about half the size to
// ensure we don't miss it.
private static final int ROW_STEP = 5; private static final int ROW_STEP = 5;
private static final int BARCODE_MIN_HEIGHT = 10; private static final int BARCODE_MIN_HEIGHT = 10;

View file

@ -713,13 +713,13 @@ public final class PDF417 {
dimension = new int[] {cols, rows}; dimension = new int[] {cols, rows};
} }
// Handle case when min values were larger than necessary // Handle case when min values were larger than necessary
if (dimension == null) { if (dimension == null) {
int rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, minCols); int rows = calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, minCols);
if (rows < minRows) { if (rows < minRows) {
dimension = new int[]{minCols, minRows}; dimension = new int[]{minCols, minRows};
} }
} }
if (dimension == null) { if (dimension == null) {
throw new WriterException("Unable to fit message in columns"); throw new WriterException("Unable to fit message in columns");

View file

@ -696,7 +696,7 @@ public class FinderPatternFinder {
} }
if (distortion == Double.MAX_VALUE) { if (distortion == Double.MAX_VALUE) {
throw NotFoundException.getNotFoundInstance(); throw NotFoundException.getNotFoundInstance();
} }
return bestPatterns; return bestPatterns;

View file

@ -298,16 +298,16 @@ public final class Encoder {
* error correction level. * error correction level.
*/ */
private static boolean willFit(int numInputBits, Version version, ErrorCorrectionLevel ecLevel) { private static boolean willFit(int numInputBits, Version version, ErrorCorrectionLevel ecLevel) {
// In the following comments, we use numbers of Version 7-H. // In the following comments, we use numbers of Version 7-H.
// numBytes = 196 // numBytes = 196
int numBytes = version.getTotalCodewords(); int numBytes = version.getTotalCodewords();
// getNumECBytes = 130 // getNumECBytes = 130
Version.ECBlocks ecBlocks = version.getECBlocksForLevel(ecLevel); Version.ECBlocks ecBlocks = version.getECBlocksForLevel(ecLevel);
int numEcBytes = ecBlocks.getTotalECCodewords(); int numEcBytes = ecBlocks.getTotalECCodewords();
// getNumDataBytes = 196 - 130 = 66 // getNumDataBytes = 196 - 130 = 66
int numDataBytes = numBytes - numEcBytes; int numDataBytes = numBytes - numEcBytes;
int totalInputBytes = (numInputBits + 7) / 8; int totalInputBytes = (numInputBits + 7) / 8;
return numDataBytes >= totalInputBytes; return numDataBytes >= totalInputBytes;
} }
/** /**

View file

@ -25,9 +25,9 @@ import org.junit.Test;
public final class PlanarYUVLuminanceSourceTestCase extends Assert { public final class PlanarYUVLuminanceSourceTestCase extends Assert {
private static final byte[] YUV = { private static final byte[] YUV = {
0, 1, 1, 2, 3, 5, 0, 1, 1, 2, 3, 5,
8, 13, 21, 34, 55, 89, 8, 13, 21, 34, 55, 89,
0, -1, -1, -2, -3, -5, 0, -1, -1, -2, -3, -5,
-8, -13, -21, -34, -55, -89, -8, -13, -21, -34, -55, -89,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,

View file

@ -35,32 +35,32 @@ public final class DecoderTest extends Assert {
@Test @Test
public void testHighLevelDecode() throws FormatException { public void testHighLevelDecode() throws FormatException {
// no ECI codes // no ECI codes
testHighLevelDecodeString("A. b.", testHighLevelDecodeString("A. b.",
// 'A' P/S '. ' L/L b D/L '.' // 'A' P/S '. ' L/L b D/L '.'
"...X. ..... ...XX XXX.. ...XX XXXX. XX.X"); "...X. ..... ...XX XXX.. ...XX XXXX. XX.X");
// initial ECI code 26 (switch to UTF-8) // initial ECI code 26 (switch to UTF-8)
testHighLevelDecodeString("Ça", testHighLevelDecodeString("Ça",
// P/S FLG(n) 2 '2' '6' B/S 2 0xc3 0x87 L/L 'a' // P/S FLG(n) 2 '2' '6' B/S 2 0xc3 0x87 L/L 'a'
"..... ..... .X. .X.. X... XXXXX ...X. XX....XX X....XXX XXX.. ...X."); "..... ..... .X. .X.. X... XXXXX ...X. XX....XX X....XXX XXX.. ...X.");
// initial character without ECI (must be interpreted as ISO_8859_1) // initial character without ECI (must be interpreted as ISO_8859_1)
// followed by ECI code 26 (= UTF-8) and UTF-8 text // followed by ECI code 26 (= UTF-8) and UTF-8 text
testHighLevelDecodeString("±Ça", testHighLevelDecodeString("±Ça",
// B/S 1 0xb1 P/S FLG(n) 2 '2' '6' B/S 2 0xc3 0x87 L/L 'a' // B/S 1 0xb1 P/S FLG(n) 2 '2' '6' B/S 2 0xc3 0x87 L/L 'a'
"XXXXX ....X X.XX...X ..... ..... .X. .X.. X... XXXXX ...X. XX....XX X....XXX XXX.. ...X."); "XXXXX ....X X.XX...X ..... ..... .X. .X.. X... XXXXX ...X. XX....XX X....XXX XXX.. ...X.");
// GS1 data // GS1 data
testHighLevelDecodeString("101233742", testHighLevelDecodeString("101233742",
// P/S FLG(n) 0 D/L 1 0 1 2 3 P/S FLG(n) 0 3 7 4 2 // P/S FLG(n) 0 D/L 1 0 1 2 3 P/S FLG(n) 0 3 7 4 2
"..... ..... ... XXXX. ..XX ..X. ..XX .X.. .X.X .... ..... ... .X.X X..X .XX. .X.."); "..... ..... ... XXXX. ..XX ..X. ..XX .X.. .X.X .... ..... ... .X.X X..X .XX. .X..");
} }
private static void testHighLevelDecodeString(String expectedString, String b) throws FormatException { private static void testHighLevelDecodeString(String expectedString, String b) throws FormatException {
BitArray bits = EncoderTest.toBitArray(EncoderTest.stripSpace(b)); BitArray bits = EncoderTest.toBitArray(EncoderTest.stripSpace(b));
assertEquals("highLevelDecode() failed for input bits: " + b, assertEquals("highLevelDecode() failed for input bits: " + b,
expectedString, Decoder.highLevelDecode(EncoderTest.toBooleanArray(bits))); expectedString, Decoder.highLevelDecode(EncoderTest.toBooleanArray(bits)));
} }
@Test @Test

View file

@ -136,7 +136,7 @@ public final class EncoderTest extends Assert {
public void testAztecWriter() throws Exception { public void testAztecWriter() throws Exception {
testWriter("Espa\u00F1ol", null, 25, true, 1); // Without ECI (implicit ISO-8859-1) testWriter("Espa\u00F1ol", null, 25, true, 1); // Without ECI (implicit ISO-8859-1)
testWriter("Espa\u00F1ol", ISO_8859_1, 25, true, 1); // Explicit ISO-8859-1 testWriter("Espa\u00F1ol", ISO_8859_1, 25, true, 1); // Explicit ISO-8859-1
testWriter("\u20AC 1 sample data.", WINDOWS_1252, 25, true, 2); // Standard ISO-8859-1 cannot encode Euro symbol; Windows-1252 superset can testWriter("\u20AC 1 sample data.", WINDOWS_1252, 25, true, 2); // ISO-8859-1 can't encode Euro; Windows-1252 can
testWriter("\u20AC 1 sample data.", ISO_8859_15, 25, true, 2); testWriter("\u20AC 1 sample data.", ISO_8859_15, 25, true, 2);
testWriter("\u20AC 1 sample data.", UTF_8, 25, true, 2); testWriter("\u20AC 1 sample data.", UTF_8, 25, true, 2);
testWriter("\u20AC 1 sample data.", UTF_8, 100, true, 3); testWriter("\u20AC 1 sample data.", UTF_8, 100, true, 3);
@ -220,42 +220,42 @@ public final class EncoderTest extends Assert {
@Test @Test
public void testEncodeDecode31() throws Exception { public void testEncodeDecode31() throws Exception {
testEncodeDecode("In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus quis diam" + testEncodeDecode("In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus quis diam" +
" cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec laoreet rutrum" + " cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec laoreet rutrum" +
" est, nec convallis mauris condimentum sit amet. Phasellus gravida, justo et congue" + " est, nec convallis mauris condimentum sit amet. Phasellus gravida, justo et congue" +
" auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec lorem. Nulla" + " auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec lorem. Nulla" +
" ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar nisi, id" + " ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar nisi, id" +
" elementum sapien dolor et diam. Donec ac nunc sodales elit placerat eleifend." + " elementum sapien dolor et diam. Donec ac nunc sodales elit placerat eleifend." +
" Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra fringilla, risus" + " Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra fringilla, risus" +
" justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo diam, lobortis eu" + " justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo diam, lobortis eu" +
" tristique ac, p.In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus" + " tristique ac, p.In ut magna vel mauris malesuada dictum. Nulla ullamcorper metus" +
" quis diam cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec" + " quis diam cursus facilisis. Sed mollis quam id justo rutrum sagittis. Donec" +
" laoreet rutrum est, nec convallis mauris condimentum sit amet. Phasellus gravida," + " laoreet rutrum est, nec convallis mauris condimentum sit amet. Phasellus gravida," +
" justo et congue auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec" + " justo et congue auctor, nisi ipsum viverra erat, eget hendrerit felis turpis nec" +
" lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar" + " lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo erat pulvinar" +
" nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit placerat" + " nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit placerat" +
" eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra" + " eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at pharetra" +
" fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo" + " fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est. Ut justo" +
" diam, lobortis eu tristique ac, p. In ut magna vel mauris malesuada dictum. Nulla" + " diam, lobortis eu tristique ac, p. In ut magna vel mauris malesuada dictum. Nulla" +
" ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" + " ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." + " sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget hendrerit" + " Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget hendrerit" +
" felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo" + " felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet laoreet, justo" +
" erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit" + " erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac nunc sodales elit" +
" placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at" + " placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula, massa at" +
" pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est." + " pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus sed est." +
" Ut justo diam, lobortis eu tristique ac, p.In ut magna vel mauris malesuada" + " Ut justo diam, lobortis eu tristique ac, p.In ut magna vel mauris malesuada" +
" dictum. Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id" + " dictum. Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id" +
" justo rutrum sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum" + " justo rutrum sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum" +
" sit amet. Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat," + " sit amet. Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat," +
" eget hendrerit felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet" + " eget hendrerit felis turpis nec lorem. Nulla ultrices, elit pellentesque aliquet" +
" laoreet, justo erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac" + " laoreet, justo erat pulvinar nisi, id elementum sapien dolor et diam. Donec ac" +
" nunc sodales elit placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula," + " nunc sodales elit placerat eleifend. Sed ornare luctus ornare. Vestibulum vehicula," +
" massa at pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus" + " massa at pharetra fringilla, risus justo faucibus erat, nec porttitor nibh tellus" +
" sed est. Ut justo diam, lobortis eu tris. In ut magna vel mauris malesuada dictum." + " sed est. Ut justo diam, lobortis eu tris. In ut magna vel mauris malesuada dictum." +
" Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" + " Nulla ullamcorper metus quis diam cursus facilisis. Sed mollis quam id justo rutrum" +
" sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." + " sagittis. Donec laoreet rutrum est, nec convallis mauris condimentum sit amet." +
" Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget" + " Phasellus gravida, justo et congue auctor, nisi ipsum viverra erat, eget" +
" hendrerit felis turpis nec lorem.", false, 31); " hendrerit felis turpis nec lorem.", false, 31);
} }
@Test @Test
@ -417,8 +417,7 @@ public final class EncoderTest extends Assert {
// Latch to DIGIT rather than shift to PUNCT // Latch to DIGIT rather than shift to PUNCT
testHighLevelEncodeString("A. 1234", testHighLevelEncodeString("A. 1234",
// 'A' D/L '.' ' ' '1' '2' '3' '4' // 'A' D/L '.' ' ' '1' '2' '3' '4'
"...X. XXXX. XX.X ...X ..XX .X.. .X.X .X X." "...X. XXXX. XX.X ...X ..XX .X.. .X.X .X X.");
);
// Don't bother leaving Binary Shift. // Don't bother leaving Binary Shift.
testHighLevelEncodeString("A\200. \200", testHighLevelEncodeString("A\200. \200",
// 'A' B/S =2 \200 "." " " \200 // 'A' B/S =2 \200 "." " " \200
@ -516,7 +515,7 @@ public final class EncoderTest extends Assert {
// Perform an encode-decode round-trip because it can be lossy. // Perform an encode-decode round-trip because it can be lossy.
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class); Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
if (null != charset) { if (null != charset) {
hints.put(EncodeHintType.CHARACTER_SET, charset.name()); hints.put(EncodeHintType.CHARACTER_SET, charset.name());
} }
hints.put(EncodeHintType.ERROR_CORRECTION, eccPercent); hints.put(EncodeHintType.ERROR_CORRECTION, eccPercent);
AztecWriter writer = new AztecWriter(); AztecWriter writer = new AztecWriter();

View file

@ -30,7 +30,8 @@ public final class AddressBookParsedResultTestCase extends Assert {
@Test @Test
public void testAddressBookDocomo() { public void testAddressBookDocomo() {
doTest("MECARD:N:Sean Owen;;", null, new String[] {"Sean Owen"}, null, null, null, null, null, null, null, null, null); doTest("MECARD:N:Sean Owen;;", null, new String[] {"Sean Owen"},
null, null, null, null, null, null, null, null, null);
doTest("MECARD:NOTE:ZXing Team;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;;", doTest("MECARD:NOTE:ZXing Team;N:Sean Owen;URL:google.com;EMAIL:srowen@example.org;;",
null, new String[] {"Sean Owen"}, null, null, new String[] {"srowen@example.org"}, null, null, null, null, new String[] {"Sean Owen"}, null, null, new String[] {"srowen@example.org"}, null, null, null,
new String[] {"google.com"}, null, "ZXing Team"); new String[] {"google.com"}, null, "ZXing Team");
@ -45,7 +46,8 @@ public final class AddressBookParsedResultTestCase extends Assert {
@Test @Test
public void testVCard() { public void testVCard() {
doTest("BEGIN:VCARD\r\nADR;HOME:123 Main St\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD", doTest("BEGIN:VCARD\r\nADR;HOME:123 Main St\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD",
null, new String[] {"Sean Owen"}, null, new String[] {"123 Main St"}, null, null, null, null, null, null, null); null, new String[] {"Sean Owen"}, null, new String[] {"123 Main St"},
null, null, null, null, null, null, null);
} }
@Test @Test
@ -69,13 +71,15 @@ public final class AddressBookParsedResultTestCase extends Assert {
@Test @Test
public void testVCardCaseInsensitive() { public void testVCardCaseInsensitive() {
doTest("begin:vcard\r\nadr;HOME:123 Main St\r\nVersion:2.1\r\nn:Owen;Sean\r\nEND:VCARD", doTest("begin:vcard\r\nadr;HOME:123 Main St\r\nVersion:2.1\r\nn:Owen;Sean\r\nEND:VCARD",
null, new String[] {"Sean Owen"}, null, new String[] {"123 Main St"}, null, null, null, null, null, null, null); null, new String[] {"Sean Owen"}, null, new String[] {"123 Main St"},
null, null, null, null, null, null, null);
} }
@Test @Test
public void testEscapedVCard() { public void testEscapedVCard() {
doTest("BEGIN:VCARD\r\nADR;HOME:123\\;\\\\ Main\\, St\\nHome\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD", doTest("BEGIN:VCARD\r\nADR;HOME:123\\;\\\\ Main\\, St\\nHome\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD",
null, new String[] {"Sean Owen"}, null, new String[] {"123;\\ Main, St\nHome"}, null, null, null, null, null, null, null); null, new String[] {"Sean Owen"}, null, new String[] {"123;\\ Main, St\nHome"},
null, null, null, null, null, null, null);
} }
@Test @Test
@ -162,4 +166,4 @@ public final class AddressBookParsedResultTestCase extends Assert {
assertEquals(note, addressResult.getNote()); assertEquals(note, addressResult.getNote());
} }
} }

View file

@ -35,6 +35,7 @@ public final class URIParsedResultTestCase extends Assert {
doTest("MEBKM:URL:google.com;TITLE:Google;", "http://google.com", "Google"); doTest("MEBKM:URL:google.com;TITLE:Google;", "http://google.com", "Google");
} }
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testURI() { public void testURI() {
doTest("google.com", "http://google.com", null); doTest("google.com", "http://google.com", null);
@ -122,7 +123,7 @@ public final class URIParsedResultTestCase extends Assert {
assertEquals(uri, uriResult.getURI()); assertEquals(uri, uriResult.getURI());
assertEquals(title, uriResult.getTitle()); assertEquals(title, uriResult.getTitle());
} }
private static void doTestNotUri(String text) { private static void doTestNotUri(String text) {
Result fakeResult = new Result(text, null, null, BarcodeFormat.QR_CODE); Result fakeResult = new Result(text, null, null, BarcodeFormat.QR_CODE);
ParsedResult result = ResultParser.parseResult(fakeResult); ParsedResult result = ResultParser.parseResult(fakeResult);
@ -136,4 +137,4 @@ public final class URIParsedResultTestCase extends Assert {
assertSame(malicious ? ParsedResultType.TEXT : ParsedResultType.URI, result.getType()); assertSame(malicious ? ParsedResultType.TEXT : ParsedResultType.URI, result.getType());
} }
} }

View file

@ -69,7 +69,8 @@ public final class StringUtilsTestCase extends Assert {
// 调压柜 // 调压柜
doTest(new byte[] { (byte) 0xFE, (byte) 0xFF, (byte) 0x8c, (byte) 0x03, (byte) 0x53, (byte) 0x8b, doTest(new byte[] { (byte) 0xFE, (byte) 0xFF, (byte) 0x8c, (byte) 0x03, (byte) 0x53, (byte) 0x8b,
(byte) 0x67, (byte) 0xdc, }, (byte) 0x67, (byte) 0xdc, },
StandardCharsets.UTF_16, StandardCharsets.UTF_16.name()); StandardCharsets.UTF_16,
StandardCharsets.UTF_16.name());
} }
@Test @Test
@ -77,7 +78,8 @@ public final class StringUtilsTestCase extends Assert {
// 调压柜 // 调压柜
doTest(new byte[] { (byte) 0xFF, (byte) 0xFE, (byte) 0x03, (byte) 0x8c, (byte) 0x8b, (byte) 0x53, doTest(new byte[] { (byte) 0xFF, (byte) 0xFE, (byte) 0x03, (byte) 0x8c, (byte) 0x8b, (byte) 0x53,
(byte) 0xdc, (byte) 0x67, }, (byte) 0xdc, (byte) 0x67, },
StandardCharsets.UTF_16, StandardCharsets.UTF_16.name()); StandardCharsets.UTF_16,
StandardCharsets.UTF_16.name());
} }
private static void doTest(byte[] bytes, Charset charset, String encoding) { private static void doTest(byte[] bytes, Charset charset, String encoding) {

View file

@ -36,16 +36,19 @@ public final class ReedSolomonTestCase extends Assert {
// real life test cases // real life test cases
testEncodeDecode(GenericGF.DATA_MATRIX_FIELD_256, testEncodeDecode(GenericGF.DATA_MATRIX_FIELD_256,
new int[] { 142, 164, 186 }, new int[] { 114, 25, 5, 88, 102 }); new int[] { 142, 164, 186 }, new int[] { 114, 25, 5, 88, 102 });
testEncodeDecode(GenericGF.DATA_MATRIX_FIELD_256, new int[] { testEncodeDecode(GenericGF.DATA_MATRIX_FIELD_256,
0x69, 0x75, 0x75, 0x71, 0x3B, 0x30, 0x30, 0x64,
0x70, 0x65, 0x66, 0x2F, 0x68, 0x70, 0x70, 0x68,
0x6D, 0x66, 0x2F, 0x64, 0x70, 0x6E, 0x30, 0x71,
0x30, 0x7B, 0x79, 0x6A, 0x6F, 0x68, 0x30, 0x81,
0xF0, 0x88, 0x1F, 0xB5 },
new int[] { new int[] {
0x1C, 0x64, 0xEE, 0xEB, 0xD0, 0x1D, 0x00, 0x03, 0x69, 0x75, 0x75, 0x71, 0x3B, 0x30, 0x30, 0x64,
0xF0, 0x1C, 0xF1, 0xD0, 0x6D, 0x00, 0x98, 0xDA, 0x70, 0x65, 0x66, 0x2F, 0x68, 0x70, 0x70, 0x68,
0x80, 0x88, 0xBE, 0xFF, 0xB7, 0xFA, 0xA9, 0x95 }); 0x6D, 0x66, 0x2F, 0x64, 0x70, 0x6E, 0x30, 0x71,
0x30, 0x7B, 0x79, 0x6A, 0x6F, 0x68, 0x30, 0x81,
0xF0, 0x88, 0x1F, 0xB5
},
new int[] {
0x1C, 0x64, 0xEE, 0xEB, 0xD0, 0x1D, 0x00, 0x03,
0xF0, 0x1C, 0xF1, 0xD0, 0x6D, 0x00, 0x98, 0xDA,
0x80, 0x88, 0xBE, 0xFF, 0xB7, 0xFA, 0xA9, 0x95
});
// synthetic test cases // synthetic test cases
testEncodeDecodeRandom(GenericGF.DATA_MATRIX_FIELD_256, 10, 240); testEncodeDecodeRandom(GenericGF.DATA_MATRIX_FIELD_256, 10, 240);
testEncodeDecodeRandom(GenericGF.DATA_MATRIX_FIELD_256, 128, 127); testEncodeDecodeRandom(GenericGF.DATA_MATRIX_FIELD_256, 128, 127);
@ -55,21 +58,27 @@ public final class ReedSolomonTestCase extends Assert {
@Test @Test
public void testQRCode() { public void testQRCode() {
// Test case from example given in ISO 18004, Annex I // Test case from example given in ISO 18004, Annex I
testEncodeDecode(GenericGF.QR_CODE_FIELD_256, new int[] { testEncodeDecode(GenericGF.QR_CODE_FIELD_256,
0x10, 0x20, 0x0C, 0x56, 0x61, 0x80, 0xEC, 0x11,
0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11 },
new int[] { new int[] {
0xA5, 0x24, 0xD4, 0xC1, 0xED, 0x36, 0xC7, 0x87, 0x10, 0x20, 0x0C, 0x56, 0x61, 0x80, 0xEC, 0x11,
0x2C, 0x55 }); 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11
testEncodeDecode(GenericGF.QR_CODE_FIELD_256, new int[] { },
0x72, 0x67, 0x2F, 0x77, 0x69, 0x6B, 0x69, 0x2F,
0x4D, 0x61, 0x69, 0x6E, 0x5F, 0x50, 0x61, 0x67,
0x65, 0x3B, 0x3B, 0x00, 0xEC, 0x11, 0xEC, 0x11,
0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11 },
new int[] { new int[] {
0xD8, 0xB8, 0xEF, 0x14, 0xEC, 0xD0, 0xCC, 0x85, 0xA5, 0x24, 0xD4, 0xC1, 0xED, 0x36, 0xC7, 0x87,
0x73, 0x40, 0x0B, 0xB5, 0x5A, 0xB8, 0x8B, 0x2E, 0x2C, 0x55
0x08, 0x62 }); });
testEncodeDecode(GenericGF.QR_CODE_FIELD_256,
new int[] {
0x72, 0x67, 0x2F, 0x77, 0x69, 0x6B, 0x69, 0x2F,
0x4D, 0x61, 0x69, 0x6E, 0x5F, 0x50, 0x61, 0x67,
0x65, 0x3B, 0x3B, 0x00, 0xEC, 0x11, 0xEC, 0x11,
0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11
},
new int[] {
0xD8, 0xB8, 0xEF, 0x14, 0xEC, 0xD0, 0xCC, 0x85,
0x73, 0x40, 0x0B, 0xB5, 0x5A, 0xB8, 0x8B, 0x2E,
0x08, 0x62
});
// real life test cases // real life test cases
// synthetic test cases // synthetic test cases
testEncodeDecodeRandom(GenericGF.QR_CODE_FIELD_256, 10, 240); testEncodeDecodeRandom(GenericGF.QR_CODE_FIELD_256, 10, 240);
@ -89,298 +98,308 @@ public final class ReedSolomonTestCase extends Assert {
testEncodeDecode(GenericGF.AZTEC_DATA_6, new int[] { testEncodeDecode(GenericGF.AZTEC_DATA_6, new int[] {
0x9, 0x32, 0x1, 0x29, 0x2F, 0x2, 0x27, 0x25, 0x1, 0x1B }, 0x9, 0x32, 0x1, 0x29, 0x2F, 0x2, 0x27, 0x25, 0x1, 0x1B },
new int[] { new int[] {
0x2C, 0x2, 0xD, 0xD, 0xA, 0x16, 0x28, 0x9, 0x22, 0xA, 0x14 }); 0x2C, 0x2, 0xD, 0xD, 0xA, 0x16, 0x28, 0x9, 0x22, 0xA, 0x14
testEncodeDecode(GenericGF.AZTEC_DATA_8, new int[] { });
0xE0, 0x86, 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eDecode(GenericGF.AZTEC_DATA_10, new int[] { 0xD0, 0x95, 0x2D, 0x8D, 0x73, 0xE1, 0x19, 0x4E,
0x15C, 0x1E1, 0x2D5, 0x02E, 0x048, 0x1E2, 0x037, 0x0CD, 0x95, 0xB5, 0xF1, 0x9D, 0x6F
0x02E, 0x056, 0x26A, 0x281, 0x1C2, 0x1A6, 0x296, 0x045, },
0x041, 0x0AA, 0x095, 0x2CE, 0x003, 0x38F, 0x2CD, 0x1A2,
0x036, 0x1AD, 0x04E, 0x090, 0x271, 0x0D3, 0x02E, 0x0D5,
0x2D4, 0x032, 0x2CA, 0x281, 0x0AA, 0x04E, 0x024, 0x2D3,
0x296, 0x281, 0x0E2, 0x08A, 0x1AA, 0x28A, 0x280, 0x07C,
0x286, 0x0A1, 0x1D0, 0x1AD, 0x154, 0x032, 0x2C2, 0x1C1,
0x145, 0x02B, 0x2D4, 0x2B0, 0x033, 0x2D5, 0x276, 0x1C1,
0x282, 0x10A, 0x2B5, 0x154, 0x003, 0x385, 0x20F, 0x0C4,
0x02D, 0x050, 0x266, 0x0D5, 0x033, 0x2D5, 0x276, 0x1C1,
0x0D4, 0x2A0, 0x08F, 0x0C4, 0x024, 0x20F, 0x2E2, 0x1AD,
0x154, 0x02E, 0x056, 0x26A, 0x281, 0x090, 0x1E5, 0x14E,
0x0CF, 0x2B6, 0x1C1, 0x28A, 0x2A1, 0x04E, 0x0D5, 0x003,
0x391, 0x122, 0x286, 0x1AD, 0x2D4, 0x028, 0x262, 0x2EA,
0x0A2, 0x004, 0x176, 0x295, 0x201, 0x0D5, 0x024, 0x20F,
0x116, 0x0C1, 0x056, 0x095, 0x213, 0x004, 0x1EA, 0x28A,
0x02A, 0x234, 0x2CE, 0x037, 0x157, 0x0D3, 0x262, 0x026,
0x262, 0x2A0, 0x086, 0x106, 0x2A1, 0x126, 0x1E5, 0x266,
0x26A, 0x2A1, 0x0E6, 0x1AA, 0x281, 0x2B6, 0x271, 0x154,
0x02F, 0x0C4, 0x02D, 0x213, 0x0CE, 0x003, 0x38F, 0x2CD,
0x1A2, 0x036, 0x1B5, 0x26A, 0x086, 0x280, 0x086, 0x1AA,
0x2A1, 0x226, 0x1AD, 0x0CF, 0x2A6, 0x292, 0x2C6, 0x022,
0x1AA, 0x256, 0x0D5, 0x02D, 0x050, 0x266, 0x0D5, 0x004,
0x176, 0x295, 0x201, 0x0D3, 0x055, 0x031, 0x2CD, 0x2EA,
0x1E2, 0x261, 0x1EA, 0x28A, 0x004, 0x145, 0x026, 0x1A6,
0x1C6, 0x1F5, 0x2CE, 0x034, 0x051, 0x146, 0x1E1, 0x0B0,
0x1B0, 0x261, 0x0D5, 0x025, 0x142, 0x1C0, 0x07C, 0x0B0,
0x1E6, 0x081, 0x044, 0x02F, 0x2CF, 0x081, 0x290, 0x0A2,
0x1A6, 0x281, 0x0CD, 0x155, 0x031, 0x1A2, 0x086, 0x262,
0x2A1, 0x0CD, 0x0CA, 0x0E6, 0x1E5, 0x003, 0x394, 0x0C5,
0x030, 0x26F, 0x053, 0x0C1, 0x1B6, 0x095, 0x2D4, 0x030,
0x26F, 0x053, 0x0C0, 0x07C, 0x2E6, 0x295, 0x143, 0x2CD,
0x2CE, 0x037, 0x0C9, 0x144, 0x2CD, 0x040, 0x08E, 0x054,
0x282, 0x022, 0x2A1, 0x229, 0x053, 0x0D5, 0x262, 0x027,
0x26A, 0x1E8, 0x14D, 0x1A2, 0x004, 0x26A, 0x296, 0x281,
0x176, 0x295, 0x201, 0x0E2, 0x2C4, 0x143, 0x2D4, 0x026,
0x262, 0x2A0, 0x08F, 0x0C4, 0x031, 0x213, 0x2B5, 0x155,
0x213, 0x02F, 0x143, 0x121, 0x2A6, 0x1AD, 0x2D4, 0x034,
0x0C5, 0x026, 0x295, 0x003, 0x396, 0x2A1, 0x176, 0x295,
0x201, 0x0AA, 0x04E, 0x004, 0x1B0, 0x070, 0x275, 0x154,
0x026, 0x2C1, 0x2B3, 0x154, 0x2AA, 0x256, 0x0C1, 0x044,
0x004, 0x23F },
new int[] { new int[] {
0x379, 0x099, 0x348, 0x010, 0x090, 0x196, 0x09C, 0x1FF, 0x31, 0xD7, 0x04, 0x46, 0xB2, 0xC1, 0x06, 0x94,
0x1B0, 0x32D, 0x244, 0x0DE, 0x201, 0x386, 0x163, 0x11F, 0x17, 0xE5, 0x0C, 0x2B, 0xA3, 0x99, 0x15, 0x7F,
0x39B, 0x344, 0x3FE, 0x02F, 0x188, 0x113, 0x3D9, 0x102, 0x16, 0x3C, 0x66, 0xBA, 0x33, 0xD9, 0xE8, 0x87,
0x04A, 0x2E1, 0x1D1, 0x18E, 0x077, 0x262, 0x241, 0x20D, 0x86, 0xBB, 0x4B, 0x15, 0x4E, 0x4A, 0xDE, 0xD4,
0x1B8, 0x11D, 0x0D0, 0x0A5, 0x29C, 0x24D, 0x3E7, 0x006, 0xED, 0xA1, 0xF8, 0x47, 0x2A, 0x50, 0xA6, 0xBC,
0x2D0, 0x1B7, 0x337, 0x178, 0x0F1, 0x1E0, 0x00B, 0x01E, 0x53, 0x7D, 0x29, 0xFE, 0x06, 0x49, 0xF3, 0x73,
0x0DA, 0x1C6, 0x2D9, 0x00D, 0x28B, 0x34A, 0x252, 0x27A, 0x9F, 0xC1, 0x75
0x057, 0x0CA, 0x2C2, 0x2E4, 0x3A6, 0x0E3, 0x22B, 0x307, });
0x174, 0x292, 0x10C, 0x1ED, 0x2FD, 0x2D4, 0x0A7, 0x051, testEncodeDecode(GenericGF.AZTEC_DATA_10,
0x34F, 0x07A, 0x1D5, 0x01D, 0x22E, 0x2C2, 0x1DF, 0x08F,
0x105, 0x3FE, 0x286, 0x2A2, 0x3B1, 0x131, 0x285, 0x362,
0x315, 0x13C, 0x0F9, 0x1A2, 0x28D, 0x246, 0x1B3, 0x12C,
0x2AD, 0x0F8, 0x222, 0x0EC, 0x39F, 0x358, 0x014, 0x229,
0x0C8, 0x360, 0x1C2, 0x031, 0x098, 0x041, 0x3E4, 0x046,
0x332, 0x318, 0x2E3, 0x24E, 0x3E2, 0x1E1, 0x0BE, 0x239,
0x306, 0x3A5, 0x352, 0x351, 0x275, 0x0ED, 0x045, 0x229,
0x0BF, 0x05D, 0x253, 0x1BE, 0x02E, 0x35A, 0x0E4, 0x2E9,
0x17A, 0x166, 0x03C, 0x007 });
testEncodeDecode(GenericGF.AZTEC_DATA_12, new int[] {
0x571, 0xE1B, 0x542, 0xE12, 0x1E2, 0x0DC, 0xCD0, 0xB85,
0x69A, 0xA81, 0x709, 0xA6A, 0x584, 0x510, 0x4AA, 0x256,
0xCE0, 0x0F8, 0xFB3, 0x5A2, 0x0D9, 0xAD1, 0x389, 0x09C,
0x4D3, 0x0B8, 0xD5B, 0x503, 0x2B2, 0xA81, 0x2A8, 0x4E0,
0x92D, 0x3A5, 0xA81, 0x388, 0x8A6, 0xAA8, 0xAA0, 0x07C,
0xA18, 0xA17, 0x41A, 0xD55, 0x032, 0xB09, 0xC15, 0x142,
0xBB5, 0x2B0, 0x0CE, 0xD59, 0xD9C, 0x1A0, 0x90A, 0xAD5,
0x540, 0x0F8, 0x583, 0xCC4, 0x0B4, 0x509, 0x98D, 0x50C,
0xED5, 0x9D9, 0xC13, 0x52A, 0x023, 0xCC4, 0x092, 0x0FB,
0x89A, 0xD55, 0x02E, 0x15A, 0x6AA, 0x049, 0x079, 0x54E,
0x33E, 0xB67, 0x068, 0xAA8, 0x44E, 0x354, 0x03E, 0x452,
0x2A1, 0x9AD, 0xB50, 0x289, 0x8AE, 0xA28, 0x804, 0x5DA,
0x958, 0x04D, 0x509, 0x20F, 0x458, 0xC11, 0x589, 0x584,
0xC04, 0x7AA, 0x8A0, 0xAA3, 0x4B3, 0x837, 0x55C, 0xD39,
0x882, 0x698, 0xAA0, 0x219, 0x06A, 0x852, 0x679, 0x666,
0x9AA, 0xA13, 0x99A, 0xAA0, 0x6B6, 0x9C5, 0x540, 0xBCC,
0x40B, 0x613, 0x338, 0x03E, 0x3EC, 0xD68, 0x836, 0x6D6,
0x6A2, 0x1A8, 0x021, 0x9AA, 0xA86, 0x266, 0xB4C, 0xFA9,
0xA92, 0xB18, 0x226, 0xAA5, 0x635, 0x42D, 0x142, 0x663,
0x540, 0x45D, 0xA95, 0x804, 0xD31, 0x543, 0x1B3, 0x6EA,
0x78A, 0x617, 0xAA8, 0xA01, 0x145, 0x099, 0xA67, 0x19F,
0x5B3, 0x834, 0x145, 0x467, 0x84B, 0x06C, 0x261, 0x354,
0x255, 0x09C, 0x01F, 0x0B0, 0x798, 0x811, 0x102, 0xFB3,
0xC81, 0xA40, 0xA26, 0x9A8, 0x133, 0x555, 0x0C5, 0xA22,
0x1A6, 0x2A8, 0x4CD, 0x328, 0xE67, 0x940, 0x3E5, 0x0C5,
0x0C2, 0x6F1, 0x4CC, 0x16D, 0x895, 0xB50, 0x309, 0xBC5,
0x330, 0x07C, 0xB9A, 0x955, 0x0EC, 0xDB3, 0x837, 0x325,
0x44B, 0x344, 0x023, 0x854, 0xA08, 0x22A, 0x862, 0x914,
0xCD5, 0x988, 0x279, 0xA9E, 0x853, 0x5A2, 0x012, 0x6AA,
0x5A8, 0x15D, 0xA95, 0x804, 0xE2B, 0x114, 0x3B5, 0x026,
0x98A, 0xA02, 0x3CC, 0x40C, 0x613, 0xAD5, 0x558, 0x4C2,
0xF50, 0xD21, 0xA99, 0xADB, 0x503, 0x431, 0x426, 0xA54,
0x03E, 0x5AA, 0x15D, 0xA95, 0x804, 0xAA1, 0x380, 0x46C,
0x070, 0x9D5, 0x540, 0x9AC, 0x1AC, 0xD54, 0xAAA, 0x563,
0x044, 0x401, 0x220, 0x9F1, 0x4F0, 0xDAA, 0x170, 0x90F,
0x106, 0xE66, 0x85C, 0x2B4, 0xD54, 0x0B8, 0x4D3, 0x52C,
0x228, 0x825, 0x512, 0xB67, 0x007, 0xC7D, 0x9AD, 0x106,
0xCD6, 0x89C, 0x484, 0xE26, 0x985, 0xC6A, 0xDA8, 0x195,
0x954, 0x095, 0x427, 0x049, 0x69D, 0x2D4, 0x09C, 0x445,
0x355, 0x455, 0x003, 0xE50, 0xC50, 0xBA0, 0xD6A, 0xA81,
0x958, 0x4E0, 0xA8A, 0x15D, 0xA95, 0x806, 0x76A, 0xCEC,
0xE0D, 0x048, 0x556, 0xAAA, 0x007, 0xC2C, 0x1E6, 0x205,
0xA28, 0x4CC, 0x6A8, 0x676, 0xACE, 0xCE0, 0x9A9, 0x501,
0x1E6, 0x204, 0x907, 0xDC4, 0xD6A, 0xA81, 0x70A, 0xD35,
0x502, 0x483, 0xCAA, 0x719, 0xF5B, 0x383, 0x455, 0x422,
0x71A, 0xA01, 0xF22, 0x915, 0x0CD, 0x6DA, 0x814, 0x4C5,
0x751, 0x440, 0x22E, 0xD4A, 0xC02, 0x6A8, 0x490, 0x7A2,
0xC60, 0x8AC, 0x4AC, 0x260, 0x23D, 0x545, 0x055, 0x1A5,
0x9C1, 0xBAA, 0xE69, 0xCC4, 0x134, 0xC55, 0x010, 0xC83,
0x542, 0x933, 0xCB3, 0x34D, 0x550, 0x9CC, 0xD55, 0x035,
0xB4E, 0x2AA, 0x05E, 0x620, 0x5B0, 0x999, 0xC01, 0xF1F,
0x66B, 0x441, 0xB36, 0xB35, 0x10D, 0x401, 0x0CD, 0x554,
0x313, 0x35A, 0x67D, 0x4D4, 0x958, 0xC11, 0x355, 0x2B1,
0xAA1, 0x68A, 0x133, 0x1AA, 0x022, 0xED4, 0xAC0, 0x269,
0x8AA, 0x18D, 0x9B7, 0x53C, 0x530, 0xBD5, 0x450, 0x08A,
0x284, 0xCD3, 0x38C, 0xFAD, 0x9C1, 0xA0A, 0x2A3, 0x3C2,
0x583, 0x613, 0x09A, 0xA12, 0xA84, 0xE00, 0xF85, 0x83C,
0xC40, 0x888, 0x17D, 0x9E4, 0x0D2, 0x051, 0x34D, 0x409,
0x9AA, 0xA86, 0x2D1, 0x10D, 0x315, 0x426, 0x699, 0x473,
0x3CA, 0x01F, 0x286, 0x286, 0x137, 0x8A6, 0x60B, 0x6C4,
0xADA, 0x818, 0x4DE, 0x299, 0x803, 0xE5C, 0xD4A, 0xA87,
0x66D, 0x9C1, 0xB99, 0x2A2, 0x59A, 0x201, 0x1C2, 0xA50,
0x411, 0x543, 0x148, 0xA66, 0xACC, 0x413, 0xCD4, 0xF42,
0x9AD, 0x100, 0x935, 0x52D, 0x40A, 0xED4, 0xAC0, 0x271,
0x588, 0xA1D, 0xA81, 0x34C, 0x550, 0x11E, 0x620, 0x630,
0x9D6, 0xAAA, 0xC26, 0x17A, 0x869, 0x0D4, 0xCD6, 0xDA8,
0x1A1, 0x8A1, 0x352, 0xA01, 0xF2D, 0x50A, 0xED4, 0xAC0,
0x255, 0x09C, 0x023, 0x603, 0x84E, 0xAAA, 0x04D, 0x60D,
0x66A, 0xA55, 0x52B, 0x182, 0x220, 0x091, 0x00F, 0x8A7,
0x86D, 0x50B, 0x848, 0x788, 0x373, 0x342, 0xE15, 0xA6A,
0xA05, 0xC26, 0x9A9, 0x611, 0x441, 0x2A8, 0x95B, 0x380,
0x3E3, 0xECD, 0x688, 0x366, 0xB44, 0xE24, 0x271, 0x34C,
0x2E3, 0x56D, 0x40C, 0xACA, 0xA04, 0xAA1, 0x382, 0x4B4,
0xE96, 0xA04, 0xE22, 0x29A, 0xAA2, 0xA80, 0x1F2, 0x862,
0x85D, 0x06B, 0x554, 0x0CA, 0xC27, 0x054, 0x50A, 0xED4,
0xAC0, 0x33B, 0x567, 0x670, 0x682, 0x42A, 0xB55, 0x500,
0x3E1, 0x60F, 0x310, 0x2D1, 0x426, 0x635, 0x433, 0xB56,
0x767, 0x04D, 0x4A8, 0x08F, 0x310, 0x248, 0x3EE, 0x26B,
0x554, 0x0B8, 0x569, 0xAA8, 0x124, 0x1E5, 0x538, 0xCFA,
0xD9C, 0x1A2, 0xAA1, 0x138, 0xD50, 0x0F9, 0x148, 0xA86,
0x6B6, 0xD40, 0xA26, 0x2BA, 0x8A2, 0x011, 0x76A, 0x560,
0x135, 0x424, 0x83D, 0x163, 0x045, 0x625, 0x613, 0x011,
0xEAA, 0x282, 0xA8D, 0x2CE, 0x0DD, 0x573, 0x4E6, 0x209,
0xA62, 0xA80, 0x864, 0x1AA, 0x149, 0x9E5, 0x99A, 0x6AA,
0x84E, 0x66A, 0xA81, 0xADA, 0x715, 0x502, 0xF31, 0x02D,
0x84C, 0xCE0, 0x0F8, 0xFB3, 0x5A2, 0x0D9, 0xB59, 0xA88,
0x6A0, 0x086, 0x6AA, 0xA18, 0x99A, 0xD33, 0xEA6, 0xA4A,
0xC60, 0x89A, 0xA95, 0x8D5, 0x0B4, 0x509, 0x98D, 0x501,
0x176, 0xA56, 0x013, 0x4C5, 0x50C, 0x6CD, 0xBA9, 0xE29,
0x85E, 0xAA2, 0x804, 0x514, 0x266, 0x99C, 0x67D, 0x6CE,
0x0D0, 0x515, 0x19E, 0x12C, 0x1B0, 0x984, 0xD50, 0x954,
0x270, 0x07C, 0x2C1, 0xE62, 0x044, 0x40B, 0xECF, 0x206,
0x902, 0x89A, 0x6A0, 0x4CD, 0x554, 0x316, 0x888, 0x698,
0xAA1, 0x334, 0xCA3, 0x99E, 0x500, 0xF94, 0x314, 0x309,
0xBC5, 0x330, 0x5B6, 0x256, 0xD40, 0xC26, 0xF14, 0xCC0,
0x1F2, 0xE6A, 0x554, 0x3B3, 0x6CE, 0x0DC, 0xC95, 0x12C,
0xD10, 0x08E, 0x152, 0x820, 0x8AA, 0x18A, 0x453, 0x356,
0x620, 0x9E6, 0xA7A, 0x14D, 0x688, 0x049, 0xAA9, 0x6A0,
0x576, 0xA56, 0x013, 0x8AC, 0x450, 0xED4, 0x09A, 0x62A,
0x808, 0xF31, 0x031, 0x84E, 0xB55, 0x561, 0x30B, 0xD43,
0x486, 0xA66, 0xB6D, 0x40D, 0x0C5, 0x09A, 0x950, 0x0F9,
0x6A8, 0x576, 0xA56, 0x012, 0xA84, 0xE01, 0x1B0, 0x1C2,
0x755, 0x502, 0x6B0, 0x6B3, 0x552, 0xAA9, 0x58C, 0x111,
0x004, 0x882, 0x7C5, 0x3C3, 0x6A8, 0x5C2, 0x43C, 0x41B,
0x99A, 0x170, 0xAD3, 0x550, 0x2E1, 0x34D, 0x4B0, 0x8A2,
0x095, 0x44A, 0xD9C, 0x01F, 0x1F6, 0x6B4, 0x41B, 0x35A,
0x271, 0x213, 0x89A, 0x617, 0x1AB, 0x6A0, 0x656, 0x550,
0x255, 0x09C, 0x125, 0xA74, 0xB50, 0x271, 0x114, 0xD55,
0x154, 0x00F, 0x943, 0x142, 0xE83, 0x5AA, 0xA06, 0x561,
0x382, 0xA28, 0x576, 0xA56, 0x019, 0xDAB, 0x3B3, 0x834,
0x121, 0x55A, 0xAA8, 0x01F, 0x0B0, 0x798, 0x816, 0x8A1,
0x331, 0xAA1, 0x9DA, 0xB3B, 0x382, 0x6A5, 0x404, 0x798,
0x812, 0x41F, 0x713, 0x5AA, 0xA05, 0xC2B, 0x4D5, 0x409,
0x20F, 0x2A9, 0xC67, 0xD6C, 0xE0D, 0x155, 0x089, 0xC6A,
0x807, 0xC8A, 0x454, 0x335, 0xB6A, 0x051, 0x315, 0xD45,
0x100, 0x8BB, 0x52B, 0x009, 0xAA1, 0x241, 0xE8B, 0x182,
0x2B1, 0x2B0, 0x980, 0x8F5, 0x514, 0x154, 0x696, 0x706,
0xEAB, 0x9A7, 0x310, 0x4D3, 0x154, 0x043, 0x20D, 0x50A,
0x4CF, 0x2CC, 0xD35, 0x542, 0x733, 0x554, 0x0D6, 0xD38,
0xAA8, 0x179, 0x881, 0x6C2, 0x667, 0x007, 0xC7D, 0x9AD,
0x106, 0xCDA, 0xCD4, 0x435, 0x004, 0x335, 0x550, 0xC4C,
0xD69, 0x9F5, 0x352, 0x563, 0x044, 0xD54, 0xAC6, 0xA85,
0xA28, 0x4CC, 0x6A8, 0x08B, 0xB52, 0xB00, 0x9A6, 0x2A8,
0x636, 0x6DD, 0x4F1, 0x4C2, 0xF55, 0x140, 0x228, 0xA13,
0x34C, 0xE33, 0xEB6, 0x706, 0x828, 0xA8C, 0xF09, 0x60D,
0x84C, 0x26A, 0x84A, 0xA13, 0x803, 0xE16, 0x0F3, 0x102,
0x220, 0x5F6, 0x790, 0x348, 0x144, 0xD35, 0x026, 0x6AA,
0xA18, 0xB44, 0x434, 0xC55, 0x099, 0xA65, 0x1CC, 0xF28,
0x07C, 0xA18, 0xA18, 0x4DE, 0x299, 0x82D, 0xB12, 0xB6A,
0x061, 0x378, 0xA66, 0x00F, 0x973, 0x52A, 0xA1D, 0x9B6,
0x706, 0xE64, 0xA89, 0x668, 0x804, 0x70A, 0x941, 0x045,
0x50C, 0x522, 0x99A, 0xB31, 0x04F, 0x353, 0xD0A, 0x6B4,
0x402, 0x4D5, 0x4B5, 0x02B, 0xB52, 0xB00, 0x9C5, 0x622,
0x876, 0xA04, 0xD31, 0x540, 0x479, 0x881, 0x8C2, 0x75A,
0xAAB, 0x098, 0x5EA, 0x1A4, 0x353, 0x35B, 0x6A0, 0x686,
0x284, 0xD4A, 0x807, 0xCB5, 0x42B, 0xB52, 0xB00, 0x954,
0x270, 0x08D, 0x80E, 0x13A, 0xAA8, 0x135, 0x835, 0x9AA,
0x801, 0xF14, 0xF0D, 0xAA1, 0x709, 0x0F1, 0x06E, 0x668,
0x5C2, 0xB4D, 0x540, 0xB84, 0xD35, 0x2C2, 0x288, 0x255,
0x12B, 0x670, 0x07C, 0x7D9, 0xAD1, 0x06C, 0xD68, 0x9C4,
0x84E, 0x269, 0x85C, 0x6AD, 0xA81, 0x959, 0x540, 0x954,
0x270, 0x496, 0x9D2, 0xD40, 0x9C4, 0x453, 0x554, 0x550,
0x03E, 0x50C, 0x50B, 0xA0D, 0x6AA, 0x819, 0x584, 0xE0A,
0x8A1, 0x5DA, 0x958, 0x067, 0x6AC, 0xECE, 0x0D0, 0x485,
0x56A, 0xAA0, 0x07C, 0x2C1, 0xE62, 0x05A, 0x284, 0xCC6,
0xA86, 0x76A, 0xCEC, 0xE09, 0xA95, 0x011, 0xE62, 0x049,
0x07D, 0xC4D, 0x6AA, 0x817, 0x0AD, 0x355, 0x024, 0x83C,
0xAA7, 0x19F, 0x5B3, 0x834, 0x554, 0x227, 0x1AA, 0x01F,
0x229, 0x150, 0xCD6, 0xDA8, 0x144, 0xC57, 0x514, 0x402,
0x2ED, 0x4AC, 0x026, 0xA84, 0x907, 0xA2C, 0x608, 0xAC4,
0xAC2, 0x602, 0x3D5, 0x450, 0x551, 0xA59, 0xC1B, 0xAAE,
0x69C, 0xC41, 0x34C, 0x550, 0x10C, 0x835, 0x429, 0x33C,
0xB33, 0x4D5, 0x509, 0xCCD, 0x550, 0x35B, 0x4E2, 0xAA0,
0x5E6, 0x205, 0xB09, 0x99C, 0x09F },
new int[] { new int[] {
0xD54, 0x221, 0x154, 0x7CD, 0xBF3, 0x112, 0x89B, 0xC5E, 0x15C, 0x1E1, 0x2D5, 0x02E, 0x048, 0x1E2, 0x037, 0x0CD,
0x9CD, 0x07E, 0xFB6, 0x78F, 0x7FA, 0x16F, 0x377, 0x4B4, 0x02E, 0x056, 0x26A, 0x281, 0x1C2, 0x1A6, 0x296, 0x045,
0x62D, 0x475, 0xBC2, 0x861, 0xB72, 0x9D0, 0x76A, 0x5A1, 0x041, 0x0AA, 0x095, 0x2CE, 0x003, 0x38F, 0x2CD, 0x1A2,
0x22A, 0xF74, 0xDBA, 0x8B1, 0x139, 0xDCD, 0x012, 0x293, 0x036, 0x1AD, 0x04E, 0x090, 0x271, 0x0D3, 0x02E, 0x0D5,
0x705, 0xA34, 0xDD5, 0x3D2, 0x7F8, 0x0A6, 0x89A, 0x346, 0x2D4, 0x032, 0x2CA, 0x281, 0x0AA, 0x04E, 0x024, 0x2D3,
0xCE0, 0x690, 0x40E, 0xFF3, 0xC4D, 0x97F, 0x9C9, 0x016, 0x296, 0x281, 0x0E2, 0x08A, 0x1AA, 0x28A, 0x280, 0x07C,
0x73A, 0x923, 0xBCE, 0xFA9, 0xE6A, 0xB92, 0x02A, 0x07C, 0x286, 0x0A1, 0x1D0, 0x1AD, 0x154, 0x032, 0x2C2, 0x1C1,
0x04B, 0x8D5, 0x753, 0x42E, 0x67E, 0x87C, 0xEE6, 0xD7D, 0x145, 0x02B, 0x2D4, 0x2B0, 0x033, 0x2D5, 0x276, 0x1C1,
0x2BF, 0xFB2, 0xFF8, 0x42F, 0x4CB, 0x214, 0x779, 0x02D, 0x282, 0x10A, 0x2B5, 0x154, 0x003, 0x385, 0x20F, 0x0C4,
0x606, 0xA02, 0x08A, 0xD4F, 0xB87, 0xDDF, 0xC49, 0xB51, 0x02D, 0x050, 0x266, 0x0D5, 0x033, 0x2D5, 0x276, 0x1C1,
0x0E9, 0xF89, 0xAEF, 0xC92, 0x383, 0x98D, 0x367, 0xBD3, 0x0D4, 0x2A0, 0x08F, 0x0C4, 0x024, 0x20F, 0x2E2, 0x1AD,
0xA55, 0x148, 0x9DB, 0x913, 0xC79, 0x6FF, 0x387, 0x6EA, 0x154, 0x02E, 0x056, 0x26A, 0x281, 0x090, 0x1E5, 0x14E,
0x7FA, 0xC1B, 0x12D, 0x303, 0xBCA, 0x503, 0x0FB, 0xB14, 0x0CF, 0x2B6, 0x1C1, 0x28A, 0x2A1, 0x04E, 0x0D5, 0x003,
0x0D4, 0xAD1, 0xAFC, 0x9DD, 0x404, 0x145, 0x6E5, 0x8ED, 0x391, 0x122, 0x286, 0x1AD, 0x2D4, 0x028, 0x262, 0x2EA,
0xF94, 0xD72, 0x645, 0xA21, 0x1A8, 0xABF, 0xC03, 0x91E, 0x0A2, 0x004, 0x176, 0x295, 0x201, 0x0D5, 0x024, 0x20F,
0xD53, 0x48C, 0x471, 0x4E4, 0x408, 0x33C, 0x5DF, 0x73D, 0x116, 0x0C1, 0x056, 0x095, 0x213, 0x004, 0x1EA, 0x28A,
0xA2A, 0x454, 0xD77, 0xC48, 0x2F5, 0x96A, 0x9CF, 0x047, 0x02A, 0x234, 0x2CE, 0x037, 0x157, 0x0D3, 0x262, 0x026,
0x611, 0xE92, 0xC2F, 0xA98, 0x56D, 0x919, 0x615, 0x535, 0x262, 0x2A0, 0x086, 0x106, 0x2A1, 0x126, 0x1E5, 0x266,
0x67A, 0x8C1, 0x2E2, 0xBC4, 0xBE8, 0x328, 0x04F, 0x257, 0x26A, 0x2A1, 0x0E6, 0x1AA, 0x281, 0x2B6, 0x271, 0x154,
0x3F9, 0xFA5, 0x477, 0x12E, 0x94B, 0x116, 0xEF7, 0x65F, 0x02F, 0x0C4, 0x02D, 0x213, 0x0CE, 0x003, 0x38F, 0x2CD,
0x6B3, 0x915, 0xC64, 0x9AF, 0xB6C, 0x6A2, 0x50D, 0xEA3, 0x1A2, 0x036, 0x1B5, 0x26A, 0x086, 0x280, 0x086, 0x1AA,
0x26E, 0xC23, 0x817, 0xA42, 0x71A, 0x9DD, 0xDA8, 0x84D, 0x2A1, 0x226, 0x1AD, 0x0CF, 0x2A6, 0x292, 0x2C6, 0x022,
0x3F3, 0x85B, 0xB00, 0x1FC, 0xB0A, 0xC2F, 0x00C, 0x095, 0x1AA, 0x256, 0x0D5, 0x02D, 0x050, 0x266, 0x0D5, 0x004,
0xC58, 0x0E3, 0x807, 0x962, 0xC4B, 0x29A, 0x6FC, 0x958, 0x176, 0x295, 0x201, 0x0D3, 0x055, 0x031, 0x2CD, 0x2EA,
0xD29, 0x59E, 0xB14, 0x95A, 0xEDE, 0xF3D, 0xFB8, 0x0E5, 0x1E2, 0x261, 0x1EA, 0x28A, 0x004, 0x145, 0x026, 0x1A6,
0x348, 0x2E7, 0x38E, 0x56A, 0x410, 0x3B1, 0x4B0, 0x793, 0x1C6, 0x1F5, 0x2CE, 0x034, 0x051, 0x146, 0x1E1, 0x0B0,
0xAB7, 0x0BC, 0x648, 0x719, 0xE3E, 0xFB4, 0x3B4, 0xE5C, 0x1B0, 0x261, 0x0D5, 0x025, 0x142, 0x1C0, 0x07C, 0x0B0,
0x950, 0xD2A, 0x50B, 0x76F, 0x8D2, 0x3C7, 0xECC, 0x87C, 0x1E6, 0x081, 0x044, 0x02F, 0x2CF, 0x081, 0x290, 0x0A2,
0x53A, 0xBA7, 0x4C3, 0x148, 0x437, 0x820, 0xECD, 0x660, 0x1A6, 0x281, 0x0CD, 0x155, 0x031, 0x1A2, 0x086, 0x262,
0x095, 0x2F4, 0x661, 0x6A4, 0xB74, 0x5F3, 0x1D2, 0x7EC, 0x2A1, 0x0CD, 0x0CA, 0x0E6, 0x1E5, 0x003, 0x394, 0x0C5,
0x8E2, 0xA40, 0xA6F, 0xFC3, 0x3BE, 0x1E9, 0x52C, 0x233, 0x030, 0x26F, 0x053, 0x0C1, 0x1B6, 0x095, 0x2D4, 0x030,
0x173, 0x4EF, 0xA7C, 0x40B, 0x14C, 0x88D, 0xF30, 0x8D9, 0x26F, 0x053, 0x0C0, 0x07C, 0x2E6, 0x295, 0x143, 0x2CD,
0xBDB, 0x0A6, 0x940, 0xD46, 0xB2B, 0x03E, 0x46A, 0x641, 0x2CE, 0x037, 0x0C9, 0x144, 0x2CD, 0x040, 0x08E, 0x054,
0xF08, 0xAFF, 0x496, 0x68A, 0x7A4, 0x0BA, 0xD43, 0x515, 0x282, 0x022, 0x2A1, 0x229, 0x053, 0x0D5, 0x262, 0x027,
0xB26, 0xD8F, 0x05C, 0xD6E, 0xA2C, 0xF25, 0x628, 0x4E5, 0x26A, 0x1E8, 0x14D, 0x1A2, 0x004, 0x26A, 0x296, 0x281,
0x81D, 0xA2A, 0x1FF, 0x302, 0xFBD, 0x6D9, 0x711, 0xD8B, 0x176, 0x295, 0x201, 0x0E2, 0x2C4, 0x143, 0x2D4, 0x026,
0xE5C, 0x5CF, 0x42E, 0x008, 0x863, 0xB6F, 0x1E1, 0x3DA, 0x262, 0x2A0, 0x08F, 0x0C4, 0x031, 0x213, 0x2B5, 0x155,
0xACE, 0x82B, 0x2DB, 0x7EB, 0xC15, 0x79F, 0xA79, 0xDAF, 0x213, 0x02F, 0x143, 0x121, 0x2A6, 0x1AD, 0x2D4, 0x034,
0x00D, 0x2F6, 0x0CE, 0x370, 0x7E8, 0x9E6, 0x89F, 0xAE9, 0x0C5, 0x026, 0x295, 0x003, 0x396, 0x2A1, 0x176, 0x295,
0x175, 0xA95, 0x06B, 0x9DF, 0xAFF, 0x45B, 0x823, 0xAA4, 0x201, 0x0AA, 0x04E, 0x004, 0x1B0, 0x070, 0x275, 0x154,
0xC79, 0x773, 0x886, 0x854, 0x0A5, 0x6D1, 0xE55, 0xEBB, 0x026, 0x2C1, 0x2B3, 0x154, 0x2AA, 0x256, 0x0C1, 0x044,
0x518, 0xE50, 0xF8F, 0x8CC, 0x834, 0x388, 0xCD2, 0xFC1, 0x004, 0x23F
0xA55, 0x1F8, 0xD1F, 0xE08, 0xF93, 0x362, 0xA22, 0x9FA, },
0xCE5, 0x3C3, 0xDD4, 0xC53, 0xB94, 0xAD0, 0x6EB, 0x68D, new int[] {
0x660, 0x8FC, 0xBCD, 0x914, 0x16F, 0x4C0, 0x134, 0xE1A, 0x379, 0x099, 0x348, 0x010, 0x090, 0x196, 0x09C, 0x1FF,
0x76F, 0x9CB, 0x660, 0xEA0, 0x320, 0x15A, 0xCE3, 0x7E8, 0x1B0, 0x32D, 0x244, 0x0DE, 0x201, 0x386, 0x163, 0x11F,
0x03E, 0xB9A, 0xC90, 0xA14, 0x256, 0x1A8, 0x639, 0x7C6, 0x39B, 0x344, 0x3FE, 0x02F, 0x188, 0x113, 0x3D9, 0x102,
0xA59, 0xA65, 0x956, 0x9E4, 0x592, 0x6A9, 0xCFF, 0x4DC, 0x04A, 0x2E1, 0x1D1, 0x18E, 0x077, 0x262, 0x241, 0x20D,
0xAA3, 0xD2A, 0xFDE, 0xA87, 0xBF5, 0x9F0, 0xC32, 0x94F, 0x1B8, 0x11D, 0x0D0, 0x0A5, 0x29C, 0x24D, 0x3E7, 0x006,
0x675, 0x9A6, 0x369, 0x648, 0x289, 0x823, 0x498, 0x574, 0x2D0, 0x1B7, 0x337, 0x178, 0x0F1, 0x1E0, 0x00B, 0x01E,
0x8D1, 0xA13, 0xD1A, 0xBB5, 0xA19, 0x7F7, 0x775, 0x138, 0x0DA, 0x1C6, 0x2D9, 0x00D, 0x28B, 0x34A, 0x252, 0x27A,
0x949, 0xA4C, 0xE36, 0x126, 0xC85, 0xE05, 0xFEE, 0x962, 0x057, 0x0CA, 0x2C2, 0x2E4, 0x3A6, 0x0E3, 0x22B, 0x307,
0x36D, 0x08D, 0xC76, 0x1E1, 0x1EC, 0x8D7, 0x231, 0xB68, 0x174, 0x292, 0x10C, 0x1ED, 0x2FD, 0x2D4, 0x0A7, 0x051,
0x03C, 0x1DE, 0x7DF, 0x2B1, 0x09D, 0xC81, 0xDA4, 0x8F7, 0x34F, 0x07A, 0x1D5, 0x01D, 0x22E, 0x2C2, 0x1DF, 0x08F,
0x6B9, 0x947, 0x9B0 }); 0x105, 0x3FE, 0x286, 0x2A2, 0x3B1, 0x131, 0x285, 0x362,
0x315, 0x13C, 0x0F9, 0x1A2, 0x28D, 0x246, 0x1B3, 0x12C,
0x2AD, 0x0F8, 0x222, 0x0EC, 0x39F, 0x358, 0x014, 0x229,
0x0C8, 0x360, 0x1C2, 0x031, 0x098, 0x041, 0x3E4, 0x046,
0x332, 0x318, 0x2E3, 0x24E, 0x3E2, 0x1E1, 0x0BE, 0x239,
0x306, 0x3A5, 0x352, 0x351, 0x275, 0x0ED, 0x045, 0x229,
0x0BF, 0x05D, 0x253, 0x1BE, 0x02E, 0x35A, 0x0E4, 0x2E9,
0x17A, 0x166, 0x03C, 0x007
});
testEncodeDecode(GenericGF.AZTEC_DATA_12,
new int[] {
0x571, 0xE1B, 0x542, 0xE12, 0x1E2, 0x0DC, 0xCD0, 0xB85,
0x69A, 0xA81, 0x709, 0xA6A, 0x584, 0x510, 0x4AA, 0x256,
0xCE0, 0x0F8, 0xFB3, 0x5A2, 0x0D9, 0xAD1, 0x389, 0x09C,
0x4D3, 0x0B8, 0xD5B, 0x503, 0x2B2, 0xA81, 0x2A8, 0x4E0,
0x92D, 0x3A5, 0xA81, 0x388, 0x8A6, 0xAA8, 0xAA0, 0x07C,
0xA18, 0xA17, 0x41A, 0xD55, 0x032, 0xB09, 0xC15, 0x142,
0xBB5, 0x2B0, 0x0CE, 0xD59, 0xD9C, 0x1A0, 0x90A, 0xAD5,
0x540, 0x0F8, 0x583, 0xCC4, 0x0B4, 0x509, 0x98D, 0x50C,
0xED5, 0x9D9, 0xC13, 0x52A, 0x023, 0xCC4, 0x092, 0x0FB,
0x89A, 0xD55, 0x02E, 0x15A, 0x6AA, 0x049, 0x079, 0x54E,
0x33E, 0xB67, 0x068, 0xAA8, 0x44E, 0x354, 0x03E, 0x452,
0x2A1, 0x9AD, 0xB50, 0x289, 0x8AE, 0xA28, 0x804, 0x5DA,
0x958, 0x04D, 0x509, 0x20F, 0x458, 0xC11, 0x589, 0x584,
0xC04, 0x7AA, 0x8A0, 0xAA3, 0x4B3, 0x837, 0x55C, 0xD39,
0x882, 0x698, 0xAA0, 0x219, 0x06A, 0x852, 0x679, 0x666,
0x9AA, 0xA13, 0x99A, 0xAA0, 0x6B6, 0x9C5, 0x540, 0xBCC,
0x40B, 0x613, 0x338, 0x03E, 0x3EC, 0xD68, 0x836, 0x6D6,
0x6A2, 0x1A8, 0x021, 0x9AA, 0xA86, 0x266, 0xB4C, 0xFA9,
0xA92, 0xB18, 0x226, 0xAA5, 0x635, 0x42D, 0x142, 0x663,
0x540, 0x45D, 0xA95, 0x804, 0xD31, 0x543, 0x1B3, 0x6EA,
0x78A, 0x617, 0xAA8, 0xA01, 0x145, 0x099, 0xA67, 0x19F,
0x5B3, 0x834, 0x145, 0x467, 0x84B, 0x06C, 0x261, 0x354,
0x255, 0x09C, 0x01F, 0x0B0, 0x798, 0x811, 0x102, 0xFB3,
0xC81, 0xA40, 0xA26, 0x9A8, 0x133, 0x555, 0x0C5, 0xA22,
0x1A6, 0x2A8, 0x4CD, 0x328, 0xE67, 0x940, 0x3E5, 0x0C5,
0x0C2, 0x6F1, 0x4CC, 0x16D, 0x895, 0xB50, 0x309, 0xBC5,
0x330, 0x07C, 0xB9A, 0x955, 0x0EC, 0xDB3, 0x837, 0x325,
0x44B, 0x344, 0x023, 0x854, 0xA08, 0x22A, 0x862, 0x914,
0xCD5, 0x988, 0x279, 0xA9E, 0x853, 0x5A2, 0x012, 0x6AA,
0x5A8, 0x15D, 0xA95, 0x804, 0xE2B, 0x114, 0x3B5, 0x026,
0x98A, 0xA02, 0x3CC, 0x40C, 0x613, 0xAD5, 0x558, 0x4C2,
0xF50, 0xD21, 0xA99, 0xADB, 0x503, 0x431, 0x426, 0xA54,
0x03E, 0x5AA, 0x15D, 0xA95, 0x804, 0xAA1, 0x380, 0x46C,
0x070, 0x9D5, 0x540, 0x9AC, 0x1AC, 0xD54, 0xAAA, 0x563,
0x044, 0x401, 0x220, 0x9F1, 0x4F0, 0xDAA, 0x170, 0x90F,
0x106, 0xE66, 0x85C, 0x2B4, 0xD54, 0x0B8, 0x4D3, 0x52C,
0x228, 0x825, 0x512, 0xB67, 0x007, 0xC7D, 0x9AD, 0x106,
0xCD6, 0x89C, 0x484, 0xE26, 0x985, 0xC6A, 0xDA8, 0x195,
0x954, 0x095, 0x427, 0x049, 0x69D, 0x2D4, 0x09C, 0x445,
0x355, 0x455, 0x003, 0xE50, 0xC50, 0xBA0, 0xD6A, 0xA81,
0x958, 0x4E0, 0xA8A, 0x15D, 0xA95, 0x806, 0x76A, 0xCEC,
0xE0D, 0x048, 0x556, 0xAAA, 0x007, 0xC2C, 0x1E6, 0x205,
0xA28, 0x4CC, 0x6A8, 0x676, 0xACE, 0xCE0, 0x9A9, 0x501,
0x1E6, 0x204, 0x907, 0xDC4, 0xD6A, 0xA81, 0x70A, 0xD35,
0x502, 0x483, 0xCAA, 0x719, 0xF5B, 0x383, 0x455, 0x422,
0x71A, 0xA01, 0xF22, 0x915, 0x0CD, 0x6DA, 0x814, 0x4C5,
0x751, 0x440, 0x22E, 0xD4A, 0xC02, 0x6A8, 0x490, 0x7A2,
0xC60, 0x8AC, 0x4AC, 0x260, 0x23D, 0x545, 0x055, 0x1A5,
0x9C1, 0xBAA, 0xE69, 0xCC4, 0x134, 0xC55, 0x010, 0xC83,
0x542, 0x933, 0xCB3, 0x34D, 0x550, 0x9CC, 0xD55, 0x035,
0xB4E, 0x2AA, 0x05E, 0x620, 0x5B0, 0x999, 0xC01, 0xF1F,
0x66B, 0x441, 0xB36, 0xB35, 0x10D, 0x401, 0x0CD, 0x554,
0x313, 0x35A, 0x67D, 0x4D4, 0x958, 0xC11, 0x355, 0x2B1,
0xAA1, 0x68A, 0x133, 0x1AA, 0x022, 0xED4, 0xAC0, 0x269,
0x8AA, 0x18D, 0x9B7, 0x53C, 0x530, 0xBD5, 0x450, 0x08A,
0x284, 0xCD3, 0x38C, 0xFAD, 0x9C1, 0xA0A, 0x2A3, 0x3C2,
0x583, 0x613, 0x09A, 0xA12, 0xA84, 0xE00, 0xF85, 0x83C,
0xC40, 0x888, 0x17D, 0x9E4, 0x0D2, 0x051, 0x34D, 0x409,
0x9AA, 0xA86, 0x2D1, 0x10D, 0x315, 0x426, 0x699, 0x473,
0x3CA, 0x01F, 0x286, 0x286, 0x137, 0x8A6, 0x60B, 0x6C4,
0xADA, 0x818, 0x4DE, 0x299, 0x803, 0xE5C, 0xD4A, 0xA87,
0x66D, 0x9C1, 0xB99, 0x2A2, 0x59A, 0x201, 0x1C2, 0xA50,
0x411, 0x543, 0x148, 0xA66, 0xACC, 0x413, 0xCD4, 0xF42,
0x9AD, 0x100, 0x935, 0x52D, 0x40A, 0xED4, 0xAC0, 0x271,
0x588, 0xA1D, 0xA81, 0x34C, 0x550, 0x11E, 0x620, 0x630,
0x9D6, 0xAAA, 0xC26, 0x17A, 0x869, 0x0D4, 0xCD6, 0xDA8,
0x1A1, 0x8A1, 0x352, 0xA01, 0xF2D, 0x50A, 0xED4, 0xAC0,
0x255, 0x09C, 0x023, 0x603, 0x84E, 0xAAA, 0x04D, 0x60D,
0x66A, 0xA55, 0x52B, 0x182, 0x220, 0x091, 0x00F, 0x8A7,
0x86D, 0x50B, 0x848, 0x788, 0x373, 0x342, 0xE15, 0xA6A,
0xA05, 0xC26, 0x9A9, 0x611, 0x441, 0x2A8, 0x95B, 0x380,
0x3E3, 0xECD, 0x688, 0x366, 0xB44, 0xE24, 0x271, 0x34C,
0x2E3, 0x56D, 0x40C, 0xACA, 0xA04, 0xAA1, 0x382, 0x4B4,
0xE96, 0xA04, 0xE22, 0x29A, 0xAA2, 0xA80, 0x1F2, 0x862,
0x85D, 0x06B, 0x554, 0x0CA, 0xC27, 0x054, 0x50A, 0xED4,
0xAC0, 0x33B, 0x567, 0x670, 0x682, 0x42A, 0xB55, 0x500,
0x3E1, 0x60F, 0x310, 0x2D1, 0x426, 0x635, 0x433, 0xB56,
0x767, 0x04D, 0x4A8, 0x08F, 0x310, 0x248, 0x3EE, 0x26B,
0x554, 0x0B8, 0x569, 0xAA8, 0x124, 0x1E5, 0x538, 0xCFA,
0xD9C, 0x1A2, 0xAA1, 0x138, 0xD50, 0x0F9, 0x148, 0xA86,
0x6B6, 0xD40, 0xA26, 0x2BA, 0x8A2, 0x011, 0x76A, 0x560,
0x135, 0x424, 0x83D, 0x163, 0x045, 0x625, 0x613, 0x011,
0xEAA, 0x282, 0xA8D, 0x2CE, 0x0DD, 0x573, 0x4E6, 0x209,
0xA62, 0xA80, 0x864, 0x1AA, 0x149, 0x9E5, 0x99A, 0x6AA,
0x84E, 0x66A, 0xA81, 0xADA, 0x715, 0x502, 0xF31, 0x02D,
0x84C, 0xCE0, 0x0F8, 0xFB3, 0x5A2, 0x0D9, 0xB59, 0xA88,
0x6A0, 0x086, 0x6AA, 0xA18, 0x99A, 0xD33, 0xEA6, 0xA4A,
0xC60, 0x89A, 0xA95, 0x8D5, 0x0B4, 0x509, 0x98D, 0x501,
0x176, 0xA56, 0x013, 0x4C5, 0x50C, 0x6CD, 0xBA9, 0xE29,
0x85E, 0xAA2, 0x804, 0x514, 0x266, 0x99C, 0x67D, 0x6CE,
0x0D0, 0x515, 0x19E, 0x12C, 0x1B0, 0x984, 0xD50, 0x954,
0x270, 0x07C, 0x2C1, 0xE62, 0x044, 0x40B, 0xECF, 0x206,
0x902, 0x89A, 0x6A0, 0x4CD, 0x554, 0x316, 0x888, 0x698,
0xAA1, 0x334, 0xCA3, 0x99E, 0x500, 0xF94, 0x314, 0x309,
0xBC5, 0x330, 0x5B6, 0x256, 0xD40, 0xC26, 0xF14, 0xCC0,
0x1F2, 0xE6A, 0x554, 0x3B3, 0x6CE, 0x0DC, 0xC95, 0x12C,
0xD10, 0x08E, 0x152, 0x820, 0x8AA, 0x18A, 0x453, 0x356,
0x620, 0x9E6, 0xA7A, 0x14D, 0x688, 0x049, 0xAA9, 0x6A0,
0x576, 0xA56, 0x013, 0x8AC, 0x450, 0xED4, 0x09A, 0x62A,
0x808, 0xF31, 0x031, 0x84E, 0xB55, 0x561, 0x30B, 0xD43,
0x486, 0xA66, 0xB6D, 0x40D, 0x0C5, 0x09A, 0x950, 0x0F9,
0x6A8, 0x576, 0xA56, 0x012, 0xA84, 0xE01, 0x1B0, 0x1C2,
0x755, 0x502, 0x6B0, 0x6B3, 0x552, 0xAA9, 0x58C, 0x111,
0x004, 0x882, 0x7C5, 0x3C3, 0x6A8, 0x5C2, 0x43C, 0x41B,
0x99A, 0x170, 0xAD3, 0x550, 0x2E1, 0x34D, 0x4B0, 0x8A2,
0x095, 0x44A, 0xD9C, 0x01F, 0x1F6, 0x6B4, 0x41B, 0x35A,
0x271, 0x213, 0x89A, 0x617, 0x1AB, 0x6A0, 0x656, 0x550,
0x255, 0x09C, 0x125, 0xA74, 0xB50, 0x271, 0x114, 0xD55,
0x154, 0x00F, 0x943, 0x142, 0xE83, 0x5AA, 0xA06, 0x561,
0x382, 0xA28, 0x576, 0xA56, 0x019, 0xDAB, 0x3B3, 0x834,
0x121, 0x55A, 0xAA8, 0x01F, 0x0B0, 0x798, 0x816, 0x8A1,
0x331, 0xAA1, 0x9DA, 0xB3B, 0x382, 0x6A5, 0x404, 0x798,
0x812, 0x41F, 0x713, 0x5AA, 0xA05, 0xC2B, 0x4D5, 0x409,
0x20F, 0x2A9, 0xC67, 0xD6C, 0xE0D, 0x155, 0x089, 0xC6A,
0x807, 0xC8A, 0x454, 0x335, 0xB6A, 0x051, 0x315, 0xD45,
0x100, 0x8BB, 0x52B, 0x009, 0xAA1, 0x241, 0xE8B, 0x182,
0x2B1, 0x2B0, 0x980, 0x8F5, 0x514, 0x154, 0x696, 0x706,
0xEAB, 0x9A7, 0x310, 0x4D3, 0x154, 0x043, 0x20D, 0x50A,
0x4CF, 0x2CC, 0xD35, 0x542, 0x733, 0x554, 0x0D6, 0xD38,
0xAA8, 0x179, 0x881, 0x6C2, 0x667, 0x007, 0xC7D, 0x9AD,
0x106, 0xCDA, 0xCD4, 0x435, 0x004, 0x335, 0x550, 0xC4C,
0xD69, 0x9F5, 0x352, 0x563, 0x044, 0xD54, 0xAC6, 0xA85,
0xA28, 0x4CC, 0x6A8, 0x08B, 0xB52, 0xB00, 0x9A6, 0x2A8,
0x636, 0x6DD, 0x4F1, 0x4C2, 0xF55, 0x140, 0x228, 0xA13,
0x34C, 0xE33, 0xEB6, 0x706, 0x828, 0xA8C, 0xF09, 0x60D,
0x84C, 0x26A, 0x84A, 0xA13, 0x803, 0xE16, 0x0F3, 0x102,
0x220, 0x5F6, 0x790, 0x348, 0x144, 0xD35, 0x026, 0x6AA,
0xA18, 0xB44, 0x434, 0xC55, 0x099, 0xA65, 0x1CC, 0xF28,
0x07C, 0xA18, 0xA18, 0x4DE, 0x299, 0x82D, 0xB12, 0xB6A,
0x061, 0x378, 0xA66, 0x00F, 0x973, 0x52A, 0xA1D, 0x9B6,
0x706, 0xE64, 0xA89, 0x668, 0x804, 0x70A, 0x941, 0x045,
0x50C, 0x522, 0x99A, 0xB31, 0x04F, 0x353, 0xD0A, 0x6B4,
0x402, 0x4D5, 0x4B5, 0x02B, 0xB52, 0xB00, 0x9C5, 0x622,
0x876, 0xA04, 0xD31, 0x540, 0x479, 0x881, 0x8C2, 0x75A,
0xAAB, 0x098, 0x5EA, 0x1A4, 0x353, 0x35B, 0x6A0, 0x686,
0x284, 0xD4A, 0x807, 0xCB5, 0x42B, 0xB52, 0xB00, 0x954,
0x270, 0x08D, 0x80E, 0x13A, 0xAA8, 0x135, 0x835, 0x9AA,
0x801, 0xF14, 0xF0D, 0xAA1, 0x709, 0x0F1, 0x06E, 0x668,
0x5C2, 0xB4D, 0x540, 0xB84, 0xD35, 0x2C2, 0x288, 0x255,
0x12B, 0x670, 0x07C, 0x7D9, 0xAD1, 0x06C, 0xD68, 0x9C4,
0x84E, 0x269, 0x85C, 0x6AD, 0xA81, 0x959, 0x540, 0x954,
0x270, 0x496, 0x9D2, 0xD40, 0x9C4, 0x453, 0x554, 0x550,
0x03E, 0x50C, 0x50B, 0xA0D, 0x6AA, 0x819, 0x584, 0xE0A,
0x8A1, 0x5DA, 0x958, 0x067, 0x6AC, 0xECE, 0x0D0, 0x485,
0x56A, 0xAA0, 0x07C, 0x2C1, 0xE62, 0x05A, 0x284, 0xCC6,
0xA86, 0x76A, 0xCEC, 0xE09, 0xA95, 0x011, 0xE62, 0x049,
0x07D, 0xC4D, 0x6AA, 0x817, 0x0AD, 0x355, 0x024, 0x83C,
0xAA7, 0x19F, 0x5B3, 0x834, 0x554, 0x227, 0x1AA, 0x01F,
0x229, 0x150, 0xCD6, 0xDA8, 0x144, 0xC57, 0x514, 0x402,
0x2ED, 0x4AC, 0x026, 0xA84, 0x907, 0xA2C, 0x608, 0xAC4,
0xAC2, 0x602, 0x3D5, 0x450, 0x551, 0xA59, 0xC1B, 0xAAE,
0x69C, 0xC41, 0x34C, 0x550, 0x10C, 0x835, 0x429, 0x33C,
0xB33, 0x4D5, 0x509, 0xCCD, 0x550, 0x35B, 0x4E2, 0xAA0,
0x5E6, 0x205, 0xB09, 0x99C, 0x09F
},
new int[] {
0xD54, 0x221, 0x154, 0x7CD, 0xBF3, 0x112, 0x89B, 0xC5E,
0x9CD, 0x07E, 0xFB6, 0x78F, 0x7FA, 0x16F, 0x377, 0x4B4,
0x62D, 0x475, 0xBC2, 0x861, 0xB72, 0x9D0, 0x76A, 0x5A1,
0x22A, 0xF74, 0xDBA, 0x8B1, 0x139, 0xDCD, 0x012, 0x293,
0x705, 0xA34, 0xDD5, 0x3D2, 0x7F8, 0x0A6, 0x89A, 0x346,
0xCE0, 0x690, 0x40E, 0xFF3, 0xC4D, 0x97F, 0x9C9, 0x016,
0x73A, 0x923, 0xBCE, 0xFA9, 0xE6A, 0xB92, 0x02A, 0x07C,
0x04B, 0x8D5, 0x753, 0x42E, 0x67E, 0x87C, 0xEE6, 0xD7D,
0x2BF, 0xFB2, 0xFF8, 0x42F, 0x4CB, 0x214, 0x779, 0x02D,
0x606, 0xA02, 0x08A, 0xD4F, 0xB87, 0xDDF, 0xC49, 0xB51,
0x0E9, 0xF89, 0xAEF, 0xC92, 0x383, 0x98D, 0x367, 0xBD3,
0xA55, 0x148, 0x9DB, 0x913, 0xC79, 0x6FF, 0x387, 0x6EA,
0x7FA, 0xC1B, 0x12D, 0x303, 0xBCA, 0x503, 0x0FB, 0xB14,
0x0D4, 0xAD1, 0xAFC, 0x9DD, 0x404, 0x145, 0x6E5, 0x8ED,
0xF94, 0xD72, 0x645, 0xA21, 0x1A8, 0xABF, 0xC03, 0x91E,
0xD53, 0x48C, 0x471, 0x4E4, 0x408, 0x33C, 0x5DF, 0x73D,
0xA2A, 0x454, 0xD77, 0xC48, 0x2F5, 0x96A, 0x9CF, 0x047,
0x611, 0xE92, 0xC2F, 0xA98, 0x56D, 0x919, 0x615, 0x535,
0x67A, 0x8C1, 0x2E2, 0xBC4, 0xBE8, 0x328, 0x04F, 0x257,
0x3F9, 0xFA5, 0x477, 0x12E, 0x94B, 0x116, 0xEF7, 0x65F,
0x6B3, 0x915, 0xC64, 0x9AF, 0xB6C, 0x6A2, 0x50D, 0xEA3,
0x26E, 0xC23, 0x817, 0xA42, 0x71A, 0x9DD, 0xDA8, 0x84D,
0x3F3, 0x85B, 0xB00, 0x1FC, 0xB0A, 0xC2F, 0x00C, 0x095,
0xC58, 0x0E3, 0x807, 0x962, 0xC4B, 0x29A, 0x6FC, 0x958,
0xD29, 0x59E, 0xB14, 0x95A, 0xEDE, 0xF3D, 0xFB8, 0x0E5,
0x348, 0x2E7, 0x38E, 0x56A, 0x410, 0x3B1, 0x4B0, 0x793,
0xAB7, 0x0BC, 0x648, 0x719, 0xE3E, 0xFB4, 0x3B4, 0xE5C,
0x950, 0xD2A, 0x50B, 0x76F, 0x8D2, 0x3C7, 0xECC, 0x87C,
0x53A, 0xBA7, 0x4C3, 0x148, 0x437, 0x820, 0xECD, 0x660,
0x095, 0x2F4, 0x661, 0x6A4, 0xB74, 0x5F3, 0x1D2, 0x7EC,
0x8E2, 0xA40, 0xA6F, 0xFC3, 0x3BE, 0x1E9, 0x52C, 0x233,
0x173, 0x4EF, 0xA7C, 0x40B, 0x14C, 0x88D, 0xF30, 0x8D9,
0xBDB, 0x0A6, 0x940, 0xD46, 0xB2B, 0x03E, 0x46A, 0x641,
0xF08, 0xAFF, 0x496, 0x68A, 0x7A4, 0x0BA, 0xD43, 0x515,
0xB26, 0xD8F, 0x05C, 0xD6E, 0xA2C, 0xF25, 0x628, 0x4E5,
0x81D, 0xA2A, 0x1FF, 0x302, 0xFBD, 0x6D9, 0x711, 0xD8B,
0xE5C, 0x5CF, 0x42E, 0x008, 0x863, 0xB6F, 0x1E1, 0x3DA,
0xACE, 0x82B, 0x2DB, 0x7EB, 0xC15, 0x79F, 0xA79, 0xDAF,
0x00D, 0x2F6, 0x0CE, 0x370, 0x7E8, 0x9E6, 0x89F, 0xAE9,
0x175, 0xA95, 0x06B, 0x9DF, 0xAFF, 0x45B, 0x823, 0xAA4,
0xC79, 0x773, 0x886, 0x854, 0x0A5, 0x6D1, 0xE55, 0xEBB,
0x518, 0xE50, 0xF8F, 0x8CC, 0x834, 0x388, 0xCD2, 0xFC1,
0xA55, 0x1F8, 0xD1F, 0xE08, 0xF93, 0x362, 0xA22, 0x9FA,
0xCE5, 0x3C3, 0xDD4, 0xC53, 0xB94, 0xAD0, 0x6EB, 0x68D,
0x660, 0x8FC, 0xBCD, 0x914, 0x16F, 0x4C0, 0x134, 0xE1A,
0x76F, 0x9CB, 0x660, 0xEA0, 0x320, 0x15A, 0xCE3, 0x7E8,
0x03E, 0xB9A, 0xC90, 0xA14, 0x256, 0x1A8, 0x639, 0x7C6,
0xA59, 0xA65, 0x956, 0x9E4, 0x592, 0x6A9, 0xCFF, 0x4DC,
0xAA3, 0xD2A, 0xFDE, 0xA87, 0xBF5, 0x9F0, 0xC32, 0x94F,
0x675, 0x9A6, 0x369, 0x648, 0x289, 0x823, 0x498, 0x574,
0x8D1, 0xA13, 0xD1A, 0xBB5, 0xA19, 0x7F7, 0x775, 0x138,
0x949, 0xA4C, 0xE36, 0x126, 0xC85, 0xE05, 0xFEE, 0x962,
0x36D, 0x08D, 0xC76, 0x1E1, 0x1EC, 0x8D7, 0x231, 0xB68,
0x03C, 0x1DE, 0x7DF, 0x2B1, 0x09D, 0xC81, 0xDA4, 0x8F7,
0x6B9, 0x947, 0x9B0
});
// synthetic test cases // synthetic test cases
testEncodeDecodeRandom(GenericGF.AZTEC_PARAM, 2, 5); // compact mode message testEncodeDecodeRandom(GenericGF.AZTEC_PARAM, 2, 5); // compact mode message
testEncodeDecodeRandom(GenericGF.AZTEC_PARAM, 4, 6); // full mode message testEncodeDecodeRandom(GenericGF.AZTEC_PARAM, 4, 6); // full mode message
@ -406,7 +425,7 @@ public final class ReedSolomonTestCase extends Assert {
} }
} }
} }
private static void testEncodeDecodeRandom(GenericGF field, int dataSize, int ecSize) { private static void testEncodeDecodeRandom(GenericGF field, int dataSize, int ecSize) {
assertTrue("Invalid data size for " + field, dataSize > 0 && dataSize <= field.getSize() - 3); assertTrue("Invalid data size for " + field, dataSize > 0 && dataSize <= field.getSize() - 3);
assertTrue("Invalid ECC size for " + field, ecSize > 0 && ecSize + dataSize <= field.getSize()); assertTrue("Invalid ECC size for " + field, ecSize > 0 && ecSize + dataSize <= field.getSize());
@ -429,12 +448,12 @@ public final class ReedSolomonTestCase extends Assert {
testDecoder(field, dataWords, ecWords); testDecoder(field, dataWords, ecWords);
} }
} }
private static void testEncodeDecode(GenericGF field, int[] dataWords, int[] ecWords) { private static void testEncodeDecode(GenericGF field, int[] dataWords, int[] ecWords) {
testEncoder(field, dataWords, ecWords); testEncoder(field, dataWords, ecWords);
testDecoder(field, dataWords, ecWords); testDecoder(field, dataWords, ecWords);
} }
private static void testEncoder(GenericGF field, int[] dataWords, int[] ecWords) { private static void testEncoder(GenericGF field, int[] dataWords, int[] ecWords) {
ReedSolomonEncoder encoder = new ReedSolomonEncoder(field); ReedSolomonEncoder encoder = new ReedSolomonEncoder(field);
int[] messageExpected = new int[dataWords.length + ecWords.length]; int[] messageExpected = new int[dataWords.length + ecWords.length];
@ -443,7 +462,7 @@ public final class ReedSolomonTestCase extends Assert {
System.arraycopy(ecWords, 0, messageExpected, dataWords.length, ecWords.length); System.arraycopy(ecWords, 0, messageExpected, dataWords.length, ecWords.length);
System.arraycopy(dataWords, 0, message, 0, dataWords.length); System.arraycopy(dataWords, 0, message, 0, dataWords.length);
encoder.encode(message, ecWords.length); encoder.encode(message, ecWords.length);
assertDataEquals("Encode in " + field + " (" + dataWords.length + ',' + ecWords.length + ") failed", assertDataEquals("Encode in " + field + " (" + dataWords.length + ',' + ecWords.length + ") failed",
messageExpected, message); messageExpected, message);
} }
@ -456,7 +475,7 @@ public final class ReedSolomonTestCase extends Assert {
for (int j = 0; j < iterations; j++) { for (int j = 0; j < iterations; j++) {
for (int i = 0; i < ecWords.length; i++) { for (int i = 0; i < ecWords.length; i++) {
if (i > 10 && i < ecWords.length / 2 - 10) { if (i > 10 && i < ecWords.length / 2 - 10) {
// performance improvement - skip intermediate cases in long-running tests // performance improvement - skip intermediate cases in long-running tests
i += ecWords.length / 10; i += ecWords.length / 10;
} }
System.arraycopy(dataWords, 0, message, 0, dataWords.length); System.arraycopy(dataWords, 0, message, 0, dataWords.length);
@ -466,16 +485,16 @@ public final class ReedSolomonTestCase extends Assert {
decoder.decode(message, ecWords.length); decoder.decode(message, ecWords.length);
} catch (ReedSolomonException e) { } catch (ReedSolomonException e) {
// fail only if maxErrors exceeded // fail only if maxErrors exceeded
assertTrue("Decode in " + field + " (" + dataWords.length + ',' + ecWords.length + ") failed at " + assertTrue("Decode in " + field + " (" + dataWords.length + ',' + ecWords.length + ") failed at " +
i + " errors: " + e, i + " errors: " + e,
i > maxErrors); i > maxErrors);
// else stop // else stop
break; break;
} }
if (i < maxErrors) { if (i < maxErrors) {
assertDataEquals("Decode in " + field + " (" + dataWords.length + ',' + ecWords.length + ") failed at " + assertDataEquals("Decode in " + field + " (" + dataWords.length + ',' + ecWords.length + ") failed at " +
i + " errors", i + " errors",
dataWords, dataWords,
message); message);
} }
} }
@ -485,12 +504,12 @@ public final class ReedSolomonTestCase extends Assert {
private static void assertDataEquals(String message, int[] expected, int[] received) { private static void assertDataEquals(String message, int[] expected, int[] received) {
for (int i = 0; i < expected.length; i++) { for (int i = 0; i < expected.length; i++) {
if (expected[i] != received[i]) { if (expected[i] != received[i]) {
fail(message + ". Mismatch at " + i + ". Expected " + arrayToString(expected) + ", got " + fail(message + ". Mismatch at " + i + ". Expected " + arrayToString(expected) + ", got " +
arrayToString(Arrays.copyOf(received, expected.length))); arrayToString(Arrays.copyOf(received, expected.length)));
} }
} }
} }
private static String arrayToString(int[] data) { private static String arrayToString(int[] data) {
StringBuilder sb = new StringBuilder("{"); StringBuilder sb = new StringBuilder("{");
for (int i = 0; i < data.length; i++) { for (int i = 0; i < data.length; i++) {

View file

@ -66,7 +66,8 @@ public final class MultiQRCodeTestCase extends Assert {
Collection<String> expectedContents = new HashSet<>(); Collection<String> expectedContents = new HashSet<>();
expectedContents.add("You earned the class a 5 MINUTE DANCE PARTY!! Awesome! Way to go! Let's boogie!"); expectedContents.add("You earned the class a 5 MINUTE DANCE PARTY!! Awesome! Way to go! Let's boogie!");
expectedContents.add("You earned the class 5 EXTRA MINUTES OF RECESS!! Fabulous!! Way to go!!"); expectedContents.add("You earned the class 5 EXTRA MINUTES OF RECESS!! Fabulous!! Way to go!!");
expectedContents.add("You get to SIT AT MRS. SIGMON'S DESK FOR A DAY!! Awesome!! Way to go!! Guess I better clean up! :)"); expectedContents.add(
"You get to SIT AT MRS. SIGMON'S DESK FOR A DAY!! Awesome!! Way to go!! Guess I better clean up! :)");
expectedContents.add("You get to CREATE OUR JOURNAL PROMPT FOR THE DAY! Yay! Way to go! "); expectedContents.add("You get to CREATE OUR JOURNAL PROMPT FOR THE DAY! Yay! Way to go! ");
assertEquals(expectedContents, barcodeContents); assertEquals(expectedContents, barcodeContents);
} }

View file

@ -63,8 +63,9 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeWithFunc3() throws WriterException { public void testEncodeWithFunc3() throws WriterException {
String toEncode = "\u00f3" + "123"; String toEncode = "\u00f3" + "123";
// "1" "2" "3" check digit 51 String expected = QUIET_SPACE + START_CODE_B + FNC3 +
String expected = QUIET_SPACE + START_CODE_B + FNC3 + "10011100110" + "11001110010" + "11001011100" + "11101000110" + STOP + QUIET_SPACE; // "1" "2" "3" check digit 51
"10011100110" + "11001110010" + "11001011100" + "11101000110" + STOP + QUIET_SPACE;
BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0); BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
@ -75,8 +76,9 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeWithFunc2() throws WriterException { public void testEncodeWithFunc2() throws WriterException {
String toEncode = "\u00f2" + "123"; String toEncode = "\u00f2" + "123";
// "1" "2" "3" check digit 56 String expected = QUIET_SPACE + START_CODE_B + FNC2 +
String expected = QUIET_SPACE + START_CODE_B + FNC2 + "10011100110" + "11001110010" + "11001011100" + "11100010110" + STOP + QUIET_SPACE; // "1" "2" "3" check digit 56
"10011100110" + "11001110010" + "11001011100" + "11100010110" + STOP + QUIET_SPACE;
BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0); BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
@ -87,8 +89,9 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeWithFunc1() throws WriterException { public void testEncodeWithFunc1() throws WriterException {
String toEncode = "\u00f1" + "123"; String toEncode = "\u00f1" + "123";
// "12" "3" check digit 92 String expected = QUIET_SPACE + START_CODE_C + FNC1 +
String expected = QUIET_SPACE + START_CODE_C + FNC1 + "10110011100" + SWITCH_CODE_B + "11001011100" + "10101111000" + STOP + QUIET_SPACE; // "12" "3" check digit 92
"10110011100" + SWITCH_CODE_B + "11001011100" + "10101111000" + STOP + QUIET_SPACE;
BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0); BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
@ -111,8 +114,9 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeWithFunc4() throws WriterException { public void testEncodeWithFunc4() throws WriterException {
String toEncode = "\u00f4" + "123"; String toEncode = "\u00f4" + "123";
// "1" "2" "3" check digit 59 String expected = QUIET_SPACE + START_CODE_B + FNC4B +
String expected = QUIET_SPACE + START_CODE_B + FNC4B + "10011100110" + "11001110010" + "11001011100" + "11100011010" + STOP + QUIET_SPACE; // "1" "2" "3" check digit 59
"10011100110" + "11001110010" + "11001011100" + "11100011010" + STOP + QUIET_SPACE;
BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0); BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
@ -124,7 +128,8 @@ public class Code128WriterTestCase extends Assert {
public void testEncodeWithFncsAndNumberInCodesetA() throws Exception { public void testEncodeWithFncsAndNumberInCodesetA() throws Exception {
String toEncode = "\n" + "\u00f1" + "\u00f4" + "1" + "\n"; String toEncode = "\n" + "\u00f1" + "\u00f4" + "1" + "\n";
String expected = QUIET_SPACE + START_CODE_A + LF + FNC1 + FNC4A + "10011100110" + LF + "10101111000" + STOP + QUIET_SPACE; String expected = QUIET_SPACE + START_CODE_A + LF + FNC1 + FNC4A +
"10011100110" + LF + "10101111000" + STOP + QUIET_SPACE;
BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0); BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
@ -136,20 +141,26 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeSwitchBetweenCodesetsAAndB() throws Exception { public void testEncodeSwitchBetweenCodesetsAAndB() throws Exception {
// start with A switch to B and back to A // start with A switch to B and back to A
// "\0" "A" "B" Switch to B "a" "b" Switch to A "\u0010" check digit testEncode("\0ABab\u0010", QUIET_SPACE + START_CODE_A +
testEncode("\0ABab\u0010", QUIET_SPACE + START_CODE_A + "10100001100" + "10100011000" + "10001011000" + SWITCH_CODE_B + "10010110000" + "10010000110" + SWITCH_CODE_A + "10100111100" + "11001110100" + STOP + QUIET_SPACE); // "\0" "A" "B" Switch to B "a" "b"
"10100001100" + "10100011000" + "10001011000" + SWITCH_CODE_B + "10010110000" + "10010000110" +
// Switch to A "\u0010" check digit
SWITCH_CODE_A + "10100111100" + "11001110100" + STOP + QUIET_SPACE);
// start with B switch to A and back to B // start with B switch to A and back to B
// "a" "b" Switch to A "\0 "Switch to B" "a" "b" check digit testEncode("ab\0ab", QUIET_SPACE + START_CODE_B +
testEncode("ab\0ab", QUIET_SPACE + START_CODE_B + "10010110000" + "10010000110" + SWITCH_CODE_A + "10100001100" + SWITCH_CODE_B + "10010110000" + "10010000110" + "11010001110" + STOP + QUIET_SPACE); // "a" "b" Switch to A "\0" Switch to B
"10010110000" + "10010000110" + SWITCH_CODE_A + "10100001100" + SWITCH_CODE_B +
// "a" "b" check digit
"10010110000" + "10010000110" + "11010001110" + STOP + QUIET_SPACE);
} }
private void testEncode(String toEncode, String expected) throws Exception { private void testEncode(String toEncode, String expected) throws Exception {
BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0); BitMatrix result = writer.encode(toEncode, BarcodeFormat.CODE_128, 0, 0);
String actual = BitMatrixTestCase.matrixToString(result); String actual = BitMatrixTestCase.matrixToString(result);
assertEquals(toEncode, expected, actual); assertEquals(toEncode, expected, actual);
BitArray row = result.getRow(0, null); BitArray row = result.getRow(0, null);
Result rtResult = reader.decodeRow(0, row, null); Result rtResult = reader.decodeRow(0, row, null);
String actualRoundtripResultText = rtResult.getText(); String actualRoundtripResultText = rtResult.getText();
@ -209,8 +220,10 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeWithForcedCodeSetFailureCodeSetA() throws Exception { public void testEncodeWithForcedCodeSetFailureCodeSetA() throws Exception {
String toEncode = "AB123"; String toEncode = "AB123";
// would default to B "A" "B" "1" "2" "3" check digit 10 // would default to B "A" "B" "1"
String expected = QUIET_SPACE + START_CODE_A + "10100011000" + "10001011000" + "10011100110" + "11001110010" + "11001011100" + "11001000100" + STOP + QUIET_SPACE; String expected = QUIET_SPACE + START_CODE_A + "10100011000" + "10001011000" + "10011100110" +
// "2" "3" check digit 10
"11001110010" + "11001011100" + "11001000100" + STOP + QUIET_SPACE;
Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class); Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
hints.put(EncodeHintType.FORCE_CODE_SET, "A"); hints.put(EncodeHintType.FORCE_CODE_SET, "A");
@ -223,8 +236,10 @@ public class Code128WriterTestCase extends Assert {
@Test @Test
public void testEncodeWithForcedCodeSetFailureCodeSetB() throws Exception { public void testEncodeWithForcedCodeSetFailureCodeSetB() throws Exception {
String toEncode = "1234"; String toEncode = "1234";
// would default to C "1" "2" "3" "4" check digit 88 // would default to C "1" "2" "3"
String expected = QUIET_SPACE + START_CODE_B + "10011100110" + "11001110010" + "11001011100" + "11001001110" + "11110010010" + STOP + QUIET_SPACE; String expected = QUIET_SPACE + START_CODE_B + "10011100110" + "11001110010" + "11001011100" +
// "4" check digit 88
"11001001110" + "11110010010" + STOP + QUIET_SPACE;
Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class); Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
hints.put(EncodeHintType.FORCE_CODE_SET, "B"); hints.put(EncodeHintType.FORCE_CODE_SET, "B");

View file

@ -31,8 +31,9 @@ import com.google.zxing.Result;
*/ */
public final class Code39ExtendedModeTestCase extends Assert { public final class Code39ExtendedModeTestCase extends Assert {
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testDecodeExtendedMode() throws Exception { public void testDecodeExtendedMode() throws FormatException, ChecksumException, NotFoundException {
doTest("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f", doTest("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f",
"000001001011011010101001001001011001010101101001001001010110101001011010010010010101011010010110100100100101011011010010101001001001010101011001011010010010010101101011001010100100100101010110110010101001001001010101010011011010010010010101101010011010100100100101010110100110101001001001010101011001101010010010010101101010100110100100100101010110101001101001001001010110110101001010010010010101010110100110100100100101011010110100101001001001010101101101001010010010010101010101100110100100100101011010101100101001001001010101101011001010010010010101010110110010100100100101011001010101101001001001010100110101011010010010010101100110101010100100100101010010110101101001001001010110010110101010010010010101001101101010101001001001011010100101101010010010010101101001011010100100100101101101001010101001001001010101100101101010010010010110101100101010010110110100000"); "000001001011011010101001001001011001010101101001001001010110101001011010010010010101011010010110100100100101011011010010101001001001010101011001011010010010010101101011001010100100100101010110110010101001001001010101010011011010010010010101101010011010100100100101010110100110101001001001010101011001101010010010010101101010100110100100100101010110101001101001001001010110110101001010010010010101010110100110100100100101011010110100101001001001010101101101001010010010010101010101100110100100100101011010101100101001001001010101101011001010010010010101010110110010100100100101011001010101101001001001010100110101011010010010010101100110101010100100100101010010110101101001001001010110010110101010010010010101001101101010101001001001011010100101101010010010010101101001011010100100100101101101001010101001001001010101100101101010010010010110101100101010010110110100000");
doTest(" !\"#$%&'()*+,-./0123456789:;<=>?", doTest(" !\"#$%&'()*+,-./0123456789:;<=>?",
@ -42,8 +43,9 @@ public final class Code39ExtendedModeTestCase extends Assert {
doTest("`abcdefghijklmnopqrstuvwxyz{|}~", doTest("`abcdefghijklmnopqrstuvwxyz{|}~",
"000001001011011010101001001001011001101010101001010010010110101001011010010100100101011010010110100101001001011011010010101001010010010101011001011010010100100101101011001010100101001001010110110010101001010010010101010011011010010100100101101010011010100101001001010110100110101001010010010101011001101010010100100101101010100110100101001001010110101001101001010010010110110101001010010100100101010110100110100101001001011010110100101001010010010101101101001010010100100101010101100110100101001001011010101100101001010010010101101011001010010100100101010110110010100101001001011001010101101001010010010100110101011010010100100101100110101010100101001001010010110101101001010010010110010110101010010100100101001101101010101001001001010110110100101010010010010101010110011010100100100101101010110010101001001001010110101100101010010010010101011011001010010110110100000"); "000001001011011010101001001001011001101010101001010010010110101001011010010100100101011010010110100101001001011011010010101001010010010101011001011010010100100101101011001010100101001001010110110010101001010010010101010011011010010100100101101010011010100101001001010110100110101001010010010101011001101010010100100101101010100110100101001001010110101001101001010010010110110101001010010100100101010110100110100101001001011010110100101001010010010101101101001010010100100101010101100110100101001001011010101100101001010010010101101011001010010100100101010110110010100101001001011001010101101001010010010100110101011010010100100101100110101010100101001001010010110101101001010010010110010110101010010100100101001101101010101001001001010110110100101010010010010101010110011010100100100101101010110010101001001001010110101100101010010010010101011011001010010110110100000");
} }
private static void doTest(String expectedResult, String encodedResult) throws FormatException, ChecksumException, NotFoundException { private static void doTest(String expectedResult, String encodedResult)
throws FormatException, ChecksumException, NotFoundException {
Code39Reader sut = new Code39Reader(false, true); Code39Reader sut = new Code39Reader(false, true);
BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0"); BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0");
BitArray row = new BitArray(matrix.getWidth()); BitArray row = new BitArray(matrix.getWidth());
@ -52,4 +54,4 @@ public final class Code39ExtendedModeTestCase extends Assert {
assertEquals(expectedResult, result.getText()); assertEquals(expectedResult, result.getText());
} }
} }

View file

@ -27,6 +27,7 @@ import org.junit.Test;
*/ */
public final class Code39WriterTestCase extends Assert { public final class Code39WriterTestCase extends Assert {
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testEncode() { public void testEncode() {
doTest("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", doTest("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",

View file

@ -31,13 +31,15 @@ import com.google.zxing.Result;
*/ */
public final class Code93ReaderTestCase extends Assert { public final class Code93ReaderTestCase extends Assert {
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testDecode() throws Exception { public void testDecode() throws FormatException, ChecksumException, NotFoundException {
doTest("Code93!\n$%/+ :\u001b;[{\u007f\u0000@`\u007f\u007f\u007f", doTest("Code93!\n$%/+ :\u001b;[{\u007f\u0000@`\u007f\u007f\u007f",
"0000001010111101101000101001100101001011001001100101100101001001100101100100101000010101010000101110101101101010001001001101001101001110010101101011101011011101011101101110100101110101101001110101110110101101010001110110101100010101110110101000110101110110101000101101110110101101001101110110101100101101110110101100110101110110101011011001110110101011001101110110101001101101110110101001110101001100101101010001010111101111"); "0000001010111101101000101001100101001011001001100101100101001001100101100100101000010101010000101110101101101010001001001101001101001110010101101011101011011101011101101110100101110101101001110101110110101101010001110110101100010101110110101000110101110110101000101101110110101101001101110110101100101101110110101100110101110110101011011001110110101011001101110110101001101101110110101001110101001100101101010001010111101111");
} }
private static void doTest(String expectedResult, String encodedResult) throws FormatException, ChecksumException, NotFoundException { private static void doTest(String expectedResult, String encodedResult)
throws FormatException, ChecksumException, NotFoundException {
Code93Reader sut = new Code93Reader(); Code93Reader sut = new Code93Reader();
BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0"); BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0");
BitArray row = new BitArray(matrix.getWidth()); BitArray row = new BitArray(matrix.getWidth());

View file

@ -29,14 +29,16 @@ public final class EAN13WriterTestCase extends Assert {
@Test @Test
public void testEncode() { public void testEncode() {
String testStr = "00001010001011010011101100110010011011110100111010101011001101101100100001010111001001110100010010100000"; String testStr =
"00001010001011010011101100110010011011110100111010101011001101101100100001010111001001110100010010100000";
BitMatrix result = new EAN13Writer().encode("5901234123457", BarcodeFormat.EAN_13, testStr.length(), 0); BitMatrix result = new EAN13Writer().encode("5901234123457", BarcodeFormat.EAN_13, testStr.length(), 0);
assertEquals(testStr, BitMatrixTestCase.matrixToString(result)); assertEquals(testStr, BitMatrixTestCase.matrixToString(result));
} }
@Test @Test
public void testAddChecksumAndEncode() { public void testAddChecksumAndEncode() {
String testStr = "00001010001011010011101100110010011011110100111010101011001101101100100001010111001001110100010010100000"; String testStr =
"00001010001011010011101100110010011011110100111010101011001101101100100001010111001001110100010010100000";
BitMatrix result = new EAN13Writer().encode("590123412345", BarcodeFormat.EAN_13, testStr.length(), 0); BitMatrix result = new EAN13Writer().encode("590123412345", BarcodeFormat.EAN_13, testStr.length(), 0);
assertEquals(testStr, BitMatrixTestCase.matrixToString(result)); assertEquals(testStr, BitMatrixTestCase.matrixToString(result));
} }

View file

@ -30,14 +30,16 @@ public final class UPCAWriterTestCase extends Assert {
@Test @Test
public void testEncode() { public void testEncode() {
String testStr = "00001010100011011011101100010001011010111101111010101011100101110100100111011001101101100101110010100000"; String testStr =
"00001010100011011011101100010001011010111101111010101011100101110100100111011001101101100101110010100000";
BitMatrix result = new UPCAWriter().encode("485963095124", BarcodeFormat.UPC_A, testStr.length(), 0); BitMatrix result = new UPCAWriter().encode("485963095124", BarcodeFormat.UPC_A, testStr.length(), 0);
assertEquals(testStr, BitMatrixTestCase.matrixToString(result)); assertEquals(testStr, BitMatrixTestCase.matrixToString(result));
} }
@Test @Test
public void testAddChecksumAndEncode() { public void testAddChecksumAndEncode() {
String testStr = "00001010011001001001101111010100011011000101011110101010001001001000111010011100101100110110110010100000"; String testStr =
"00001010011001001001101111010100011011000101011110101010001001001000111010011100101100110110110010100000";
BitMatrix result = new UPCAWriter().encode("12345678901", BarcodeFormat.UPC_A, testStr.length(), 0); BitMatrix result = new UPCAWriter().encode("12345678901", BarcodeFormat.UPC_A, testStr.length(), 0);
assertEquals(testStr, BitMatrixTestCase.matrixToString(result)); assertEquals(testStr, BitMatrixTestCase.matrixToString(result));
} }

View file

@ -38,7 +38,7 @@ import java.util.regex.Pattern;
*/ */
public final class BinaryUtilTest extends Assert { public final class BinaryUtilTest extends Assert {
private static final Pattern SPACE = Pattern.compile(" "); private static final Pattern SPACE = Pattern.compile(" ");
@Test @Test
public void testBuildBitArrayFromString() { public void testBuildBitArrayFromString() {

View file

@ -34,11 +34,11 @@ import com.google.zxing.common.AbstractBlackBoxTestCase;
* A test of {@link RSSExpandedReader} against a fixed test set of images. * A test of {@link RSSExpandedReader} against a fixed test set of images.
*/ */
public final class RSSExpandedBlackBox3TestCase extends AbstractBlackBoxTestCase { public final class RSSExpandedBlackBox3TestCase extends AbstractBlackBoxTestCase {
public RSSExpandedBlackBox3TestCase() { public RSSExpandedBlackBox3TestCase() {
super("src/test/resources/blackbox/rssexpanded-3", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED); super("src/test/resources/blackbox/rssexpanded-3", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(117, 117, 0.0f); addTest(117, 117, 0.0f);
addTest(117, 117, 180.0f); addTest(117, 117, 180.0f);
} }
} }

View file

@ -52,8 +52,8 @@ public final class RSSExpandedImage2binaryTestCase extends Assert {
@Test @Test
public void testDecodeRow2binary1() throws Exception { public void testDecodeRow2binary1() throws Exception {
// (11)100224(17)110224(3102)000100 // (11)100224(17)110224(3102)000100
assertCorrectImage2binary( assertCorrectImage2binary("1.png",
"1.png", " ...X...X .X....X. .XX...X. X..X...X ...XX.X. ..X.X... ..X.X..X ...X..X. X.X....X .X....X. .....X.. X...X..."); " ...X...X .X....X. .XX...X. X..X...X ...XX.X. ..X.X... ..X.X..X ...X..X. X.X....X .X....X. .....X.. X...X...");
} }
@Test @Test
@ -82,18 +82,20 @@ public final class RSSExpandedImage2binaryTestCase extends Assert {
"5.png", " ..X.X... .XXXX.X. XX..XXXX ....XX.. X....... ....X... ....X..X .XX."); "5.png", " ..X.X... .XXXX.X. XX..XXXX ....XX.. X....... ....X... ....X..X .XX.");
} }
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testDecodeRow2binary10() throws Exception { public void testDecodeRow2binary10() throws Exception {
// (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456(423)0123456789012 // (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456(423)0123456789012
assertCorrectImage2binary( assertCorrectImage2binary("10.png",
"10.png", " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... XX.XX..X .X..X..X .X.X.X.X X.XX...X .XX.XXX. XXX.X.XX ..X."); " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... XX.XX..X .X..X..X .X.X.X.X X.XX...X .XX.XXX. XXX.X.XX ..X.");
} }
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testDecodeRow2binary11() throws Exception { public void testDecodeRow2binary11() throws Exception {
// (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456 // (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456
assertCorrectImage2binary( assertCorrectImage2binary("11.png",
"11.png", " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... ...."); " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... ....");
} }
@Test @Test

View file

@ -52,7 +52,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01310X111() throws Exception { public void test01310X111() throws Exception {
CharSequence data = header310x11 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header310x11 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3100)001750(11)100312"; String expected = "(01)90012345678908(3100)001750(11)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -60,7 +61,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01320X111() throws Exception { public void test01320X111() throws Exception {
CharSequence data = header320x11 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header320x11 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3200)001750(11)100312"; String expected = "(01)90012345678908(3200)001750(11)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -68,7 +70,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01310X131() throws Exception { public void test01310X131() throws Exception {
CharSequence data = header310x13 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header310x13 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3100)001750(13)100312"; String expected = "(01)90012345678908(3100)001750(13)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -76,7 +79,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01320X131() throws Exception { public void test01320X131() throws Exception {
CharSequence data = header320x13 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header320x13 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3200)001750(13)100312"; String expected = "(01)90012345678908(3200)001750(13)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -84,7 +88,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01310X151() throws Exception { public void test01310X151() throws Exception {
CharSequence data = header310x15 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header310x15 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3100)001750(15)100312"; String expected = "(01)90012345678908(3100)001750(15)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -92,7 +97,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01320X151() throws Exception { public void test01320X151() throws Exception {
CharSequence data = header320x15 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header320x15 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3200)001750(15)100312"; String expected = "(01)90012345678908(3200)001750(15)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -100,7 +106,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01310X171() throws Exception { public void test01310X171() throws Exception {
CharSequence data = header310x17 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header310x17 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3100)001750(17)100312"; String expected = "(01)90012345678908(3100)001750(17)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);
@ -108,7 +115,8 @@ public final class AI013X0X1XDecoderTest extends AbstractDecoderTest {
@Test @Test
public void test01320X171() throws Exception { public void test01320X171() throws Exception {
CharSequence data = header320x17 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; CharSequence data = header320x17 + compressedGtin900123456798908 + compressed20bitWeight1750 +
compressedDateMarch12th2010;
String expected = "(01)90012345678908(3200)001750(17)100312"; String expected = "(01)90012345678908(3200)001750(17)100312";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);

View file

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
/* /*
* These authors would like to acknowledge the Spanish Ministry of Industry, * These authors would like to acknowledge the Spanish Ministry of Industry,
* Tourism and Trade, for the support in the project TSI020301-2008-2 * Tourism and Trade, for the support in the project TSI020301-2008-2
* "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
@ -53,7 +53,8 @@ public final class AnyAIDecoderTest extends AbstractDecoderTest {
@Test @Test
public void testAnyAIDecoder3() throws Exception { public void testAnyAIDecoder3() throws Exception {
CharSequence data = header + numeric10 + numeric2alpha + alpha2isoiec646 + i646B + i646C + isoiec6462alpha + alphaA + alpha2numeric + numeric10; CharSequence data = header + numeric10 + numeric2alpha + alpha2isoiec646 + i646B + i646C + isoiec6462alpha +
alphaA + alpha2numeric + numeric10;
String expected = "(10)BCA10"; String expected = "(10)BCA10";
assertCorrectBinaryString(data, expected); assertCorrectBinaryString(data, expected);

View file

@ -31,6 +31,7 @@ import org.junit.Test;
*/ */
public final class PDF417WriterTestCase extends Assert { public final class PDF417WriterTestCase extends Assert {
@SuppressWarnings("checkstyle:lineLength")
@Test @Test
public void testDataMatrixImageWriter() throws WriterException { public void testDataMatrixImageWriter() throws WriterException {
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class); Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);

View file

@ -96,35 +96,34 @@ public final class EncoderTestCase extends Assert {
@Test @Test
public void testEncode() throws WriterException { public void testEncode() throws WriterException {
QRCode qrCode = Encoder.encode("ABCDEF", ErrorCorrectionLevel.H); QRCode qrCode = Encoder.encode("ABCDEF", ErrorCorrectionLevel.H);
String expected = String expected = "<<\n" +
"<<\n" + " mode: ALPHANUMERIC\n" +
" mode: ALPHANUMERIC\n" + " ecLevel: H\n" +
" ecLevel: H\n" + " version: 1\n" +
" version: 1\n" + " maskPattern: 4\n" +
" maskPattern: 4\n" + " matrix:\n" +
" matrix:\n" + " 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1\n" + " 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1\n" + " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" + " 1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1 1 1 0 1\n" + " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 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 1 1 1\n" +
" 1 0 0 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1\n" + " 1 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1\n" +
" 1 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1\n" + " 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 1\n" +
" 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 1\n" + " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0\n" +
" 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0\n" + " 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1\n" + " 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1\n" + ">>\n";
">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }
@ -148,35 +147,34 @@ public final class EncoderTestCase extends Assert {
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class); Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
hints.put(EncodeHintType.CHARACTER_SET, "UTF8"); hints.put(EncodeHintType.CHARACTER_SET, "UTF8");
QRCode qrCode = Encoder.encode("hello", ErrorCorrectionLevel.H, hints); QRCode qrCode = Encoder.encode("hello", ErrorCorrectionLevel.H, hints);
String expected = String expected = "<<\n" +
"<<\n" + " mode: BYTE\n" +
" mode: BYTE\n" + " ecLevel: H\n" +
" ecLevel: H\n" + " version: 1\n" +
" version: 1\n" + " maskPattern: 6\n" +
" maskPattern: 6\n" + " matrix:\n" +
" matrix:\n" + " 1 1 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 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 0 0 0\n" +
" 0 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0\n" + " 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1\n" +
" 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1\n" + " 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1\n" +
" 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1\n" + " 1 1 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0\n" +
" 1 1 1 1 1 1 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0\n" + " 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0\n" +
" 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0\n" + " 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0\n" +
" 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0\n" + " 1 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 1 0 1 1 0\n" +
" 1 0 1 1 1 0 1 0 1 1 1 1 0 1 0 0 1 0 1 1 0\n" + " 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1\n" +
" 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1\n" + " 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0\n" +
" 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 0 0\n" + " 1 1 1 1 1 1 1 0 0 0 0 1 0 1 0 0 1 0 1 0 0\n" +
" 1 1 1 1 1 1 1 0 0 0 0 1 0 1 0 0 1 0 1 0 0\n" + ">>\n";
">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }
@ -186,35 +184,34 @@ public final class EncoderTestCase extends Assert {
hints.put(EncodeHintType.CHARACTER_SET, "Shift_JIS"); hints.put(EncodeHintType.CHARACTER_SET, "Shift_JIS");
// Nihon in Kanji // Nihon in Kanji
QRCode qrCode = Encoder.encode("\u65e5\u672c", ErrorCorrectionLevel.M, hints); QRCode qrCode = Encoder.encode("\u65e5\u672c", ErrorCorrectionLevel.M, hints);
String expected = String expected = "<<\n" +
"<<\n" + " mode: KANJI\n" +
" mode: KANJI\n" + " ecLevel: M\n" +
" ecLevel: M\n" + " version: 1\n" +
" version: 1\n" + " maskPattern: 0\n" +
" maskPattern: 0\n" + " matrix:\n" +
" matrix:\n" + " 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1\n" + " 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 1\n" + " 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 1 1 1 0 1\n" + " 1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 1\n" + " 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1\n" + " 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 1\n" + " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + " 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0\n" +
" 0 0 0 0 0 0 0 0 0 0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" 1 0 1 1 1 0 1 0 1 0 1 1 0 1 1 1 0 0 1 0 1\n" + " 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0\n" +
" 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0\n" + " 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 0 0\n" +
" 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 0 0\n" + ">>\n";
">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }
@ -223,35 +220,34 @@ public final class EncoderTestCase extends Assert {
Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class); Map<EncodeHintType,Object> hints = new EnumMap<>(EncodeHintType.class);
hints.put(EncodeHintType.CHARACTER_SET, "Shift_JIS"); hints.put(EncodeHintType.CHARACTER_SET, "Shift_JIS");
QRCode qrCode = Encoder.encode("0123", ErrorCorrectionLevel.M, hints); QRCode qrCode = Encoder.encode("0123", ErrorCorrectionLevel.M, hints);
String expected = String expected = "<<\n" +
"<<\n" + " mode: NUMERIC\n" +
" mode: NUMERIC\n" + " ecLevel: M\n" +
" ecLevel: M\n" + " version: 1\n" +
" version: 1\n" + " maskPattern: 2\n" +
" maskPattern: 2\n" + " matrix:\n" +
" matrix:\n" + " 1 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 1 1\n" + " 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1\n" + " 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0 1 1 1 0 1\n" + " 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1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0 0 0\n" +
" 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 0\n" + " 1 0 0 0 0 0 1 0 1 1 0 1 1 1 1 0 0 1 0 1 0\n" +
" 1 0 0 0 0 0 1 0 1 1 0 1 1 1 1 0 0 1 0 1 0\n" + " 1 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0\n" +
" 1 0 1 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0\n" + " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 1 0 0 1 0 0\n" +
" 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 1 0 0 1 0 0\n" + " 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0\n" +
" 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0\n" + " 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 0\n" +
" 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 0\n" + " 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0\n" +
" 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 1 1 1 0 0\n" + ">>\n";
">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }
@ -293,35 +289,34 @@ public final class EncoderTestCase extends Assert {
hints.put(EncodeHintType.CHARACTER_SET, "UTF8"); hints.put(EncodeHintType.CHARACTER_SET, "UTF8");
hints.put(EncodeHintType.GS1_FORMAT, true); hints.put(EncodeHintType.GS1_FORMAT, true);
QRCode qrCode = Encoder.encode("hello", ErrorCorrectionLevel.H, hints); QRCode qrCode = Encoder.encode("hello", ErrorCorrectionLevel.H, hints);
String expected = String expected = "<<\n" +
"<<\n" + " mode: BYTE\n" +
" mode: BYTE\n" + " ecLevel: H\n" +
" ecLevel: H\n" + " version: 1\n" +
" version: 1\n" + " maskPattern: 5\n" +
" maskPattern: 5\n" + " matrix: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, qrCode.toString());
} }
@ -595,10 +590,10 @@ public final class EncoderTestCase extends Assert {
@Test @Test
public void testAppendKanjiBytes() throws WriterException { public void testAppendKanjiBytes() throws WriterException {
BitArray bits = new BitArray(); BitArray bits = new BitArray();
Encoder.appendKanjiBytes(shiftJISString(bytes(0x93, 0x5f)), bits); Encoder.appendKanjiBytes(shiftJISString(bytes(0x93, 0x5f)), bits);
assertEquals(" .XX.XX.. XXXXX", bits.toString()); assertEquals(" .XX.XX.. XXXXX", bits.toString());
Encoder.appendKanjiBytes(shiftJISString(bytes(0xe4, 0xaa)), bits); Encoder.appendKanjiBytes(shiftJISString(bytes(0xe4, 0xaa)), bits);
assertEquals(" .XX.XX.. XXXXXXX. X.X.X.X. X.", bits.toString()); assertEquals(" .XX.XX.. XXXXXXX. X.X.X.X. X.", bits.toString());
} }
// Numbers are from http://www.swetake.com/qr/qr3.html and // Numbers are from http://www.swetake.com/qr/qr3.html and
@ -673,72 +668,70 @@ public final class EncoderTestCase extends Assert {
} }
private static void verifyGS1EncodedData(QRCode qrCode) { private static void verifyGS1EncodedData(QRCode qrCode) {
String expected = String expected = "<<\n" +
"<<\n" + " mode: ALPHANUMERIC\n" +
" mode: ALPHANUMERIC\n" + " ecLevel: H\n" +
" ecLevel: H\n" + " version: 2\n" +
" version: 2\n" + " maskPattern: 4\n" +
" maskPattern: 4\n" + " matrix:\n" +
" matrix:\n" + " 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + " 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1\n" + " 1 0 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 0 0 0 0 1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0 0 0 1 1 1 0 0 1 1 0 1 0 0 0\n" +
" 1 0 1 1 1 0 1 0 0 0 0 0 0 1 1 1 0 0 1 1 0 1 0 0 0\n" + " 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0\n" +
" 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 0\n" + " 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0\n" +
" 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 0 0 0\n" + " 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1\n" +
" 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1 1\n" + ">>\n";
">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }
private static void verifyNotGS1EncodedData(QRCode qrCode) { private static void verifyNotGS1EncodedData(QRCode qrCode) {
String expected = String expected = "<<\n" +
"<<\n" + " mode: ALPHANUMERIC\n" +
" mode: ALPHANUMERIC\n" + " ecLevel: H\n" +
" ecLevel: H\n" + " version: 1\n" +
" version: 1\n" + " maskPattern: 4\n" +
" maskPattern: 4\n" + " matrix:\n" +
" matrix:\n" + " 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1\n" + " 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 0 1\n" + " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" + " 1 0 1 1 1 0 1 0 0 1 0 0 1 0 1 0 1 1 1 0 1\n" +
" 1 0 1 1 1 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 0 0\n" +
" 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0\n" + " 1 0 0 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1\n" +
" 1 0 0 0 0 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1\n" + " 1 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1\n" +
" 1 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1\n" + " 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 1\n" +
" 1 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 0 1 1 1\n" + " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0\n" +
" 1 0 1 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0\n" + " 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1\n" +
" 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1\n" + " 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1\n" +
" 1 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1\n" + ">>\n";
">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }

View file

@ -185,75 +185,75 @@ public final class MaskUtilTestCase extends Assert {
@Test @Test
public void testGetDataMaskBit() { public void testGetDataMaskBit() {
int[][] mask0 = { int[][] mask0 = {
{1, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1}, {0, 1, 0, 1, 0, 1},
{1, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1}, {0, 1, 0, 1, 0, 1},
{1, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1}, {0, 1, 0, 1, 0, 1},
}; };
assertTrue(testGetDataMaskBitInternal(0, mask0)); assertTrue(testGetDataMaskBitInternal(0, mask0));
int[][] mask1 = { int[][] mask1 = {
{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1},
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},
}; };
assertTrue(testGetDataMaskBitInternal(1, mask1)); assertTrue(testGetDataMaskBitInternal(1, mask1));
int[][] mask2 = { int[][] mask2 = {
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
}; };
assertTrue(testGetDataMaskBitInternal(2, mask2)); assertTrue(testGetDataMaskBitInternal(2, mask2));
int[][] mask3 = { int[][] mask3 = {
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 1}, {0, 0, 1, 0, 0, 1},
{0, 1, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{0, 0, 1, 0, 0, 1}, {0, 0, 1, 0, 0, 1},
{0, 1, 0, 0, 1, 0}, {0, 1, 0, 0, 1, 0},
}; };
assertTrue(testGetDataMaskBitInternal(3, mask3)); assertTrue(testGetDataMaskBitInternal(3, mask3));
int[][] mask4 = { int[][] mask4 = {
{1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0},
{1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0},
{0, 0, 0, 1, 1, 1}, {0, 0, 0, 1, 1, 1},
{0, 0, 0, 1, 1, 1}, {0, 0, 0, 1, 1, 1},
{1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0},
{1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0},
}; };
assertTrue(testGetDataMaskBitInternal(4, mask4)); assertTrue(testGetDataMaskBitInternal(4, mask4));
int[][] mask5 = { int[][] mask5 = {
{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1},
{1, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 1, 0},
{1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0},
{1, 0, 0, 0, 0, 0}, {1, 0, 0, 0, 0, 0},
}; };
assertTrue(testGetDataMaskBitInternal(5, mask5)); assertTrue(testGetDataMaskBitInternal(5, mask5));
int[][] mask6 = { int[][] mask6 = {
{1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1},
{1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0},
{1, 1, 0, 1, 1, 0}, {1, 1, 0, 1, 1, 0},
{1, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 1, 0},
{1, 0, 1, 1, 0, 1}, {1, 0, 1, 1, 0, 1},
{1, 0, 0, 0, 1, 1}, {1, 0, 0, 0, 1, 1},
}; };
assertTrue(testGetDataMaskBitInternal(6, mask6)); assertTrue(testGetDataMaskBitInternal(6, mask6));
int[][] mask7 = { int[][] mask7 = {
{1, 0, 1, 0, 1, 0}, {1, 0, 1, 0, 1, 0},
{0, 0, 0, 1, 1, 1}, {0, 0, 0, 1, 1, 1},
{1, 0, 0, 0, 1, 1}, {1, 0, 0, 0, 1, 1},
{0, 1, 0, 1, 0, 1}, {0, 1, 0, 1, 0, 1},
{1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0},
{0, 1, 1, 1, 0, 0}, {0, 1, 1, 1, 0, 0},
}; };
assertTrue(testGetDataMaskBitInternal(7, mask7)); assertTrue(testGetDataMaskBitInternal(7, mask7));
} }

View file

@ -62,13 +62,13 @@ public final class QRCodeTestCase extends Assert {
public void testToString1() { public void testToString1() {
QRCode qrCode = new QRCode(); QRCode qrCode = new QRCode();
String expected = String expected =
"<<\n" + "<<\n" +
" mode: null\n" + " mode: null\n" +
" ecLevel: null\n" + " ecLevel: null\n" +
" version: null\n" + " version: null\n" +
" maskPattern: -1\n" + " maskPattern: -1\n" +
" matrix: null\n" + " matrix: null\n" +
">>\n"; ">>\n";
assertEquals(expected, qrCode.toString()); assertEquals(expected, qrCode.toString());
} }

View file

@ -98,7 +98,7 @@ public final class StringsResourceTranslator {
Collection<String> forceRetranslation = Arrays.asList(args).subList(1, args.length); Collection<String> forceRetranslation = Arrays.asList(args).subList(1, args.length);
DirectoryStream.Filter<Path> filter = entry -> DirectoryStream.Filter<Path> filter = entry ->
Files.isDirectory(entry) && !Files.isSymbolicLink(entry) && Files.isDirectory(entry) && !Files.isSymbolicLink(entry) &&
VALUES_DIR_PATTERN.matcher(entry.getFileName().toString()).matches(); VALUES_DIR_PATTERN.matcher(entry.getFileName().toString()).matches();
try (DirectoryStream<Path> dirs = Files.newDirectoryStream(resDir, filter)) { try (DirectoryStream<Path> dirs = Files.newDirectoryStream(resDir, filter)) {
for (Path dir : dirs) { for (Path dir : dirs) {
@ -206,7 +206,8 @@ public final class StringsResourceTranslator {
URLConnection connection = translateURI.toURL().openConnection(); URLConnection connection = translateURI.toURL().openConnection();
connection.connect(); connection.connect();
StringBuilder translateResult = new StringBuilder(200); StringBuilder translateResult = new StringBuilder(200);
try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) { try (BufferedReader in =
new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
char[] buffer = new char[8192]; char[] buffer = new char[8192];
int charsRead; int charsRead;
while ((charsRead = in.read(buffer)) > 0) { while ((charsRead = in.read(buffer)) > 0) {

23
pom.xml
View file

@ -166,7 +166,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version> <version>3.3.1</version>
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<quiet>true</quiet> <quiet>true</quiet>
@ -263,7 +263,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId> <artifactId>maven-scm-plugin</artifactId>
<version>1.11.3</version> <version>1.12.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -311,7 +311,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version> <version>3.3.2</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.simpligility.maven.plugins</groupId> <groupId>com.simpligility.maven.plugins</groupId>
@ -442,7 +442,7 @@
<dependency> <dependency>
<groupId>com.puppycrawl.tools</groupId> <groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId> <artifactId>checkstyle</artifactId>
<version>8.45.1</version> <version>9.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
</plugin> </plugin>
@ -690,6 +690,21 @@
</site> </site>
</distributionManagement> </distributionManagement>
<repositories>
<repository>
<id>google-maven-central</id>
<name>GCS Maven Central mirror</name>
<url>https://maven-central.storage-download.googleapis.com/maven2/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>google-maven-central</id>
<name>GCS Maven Central mirror</name>
<url>https://maven-central.storage-download.googleapis.com/maven2/</url>
</pluginRepository>
</pluginRepositories>
<profiles> <profiles>
<profile> <profile>
<id>build-android</id> <id>build-android</id>

View file

@ -104,11 +104,6 @@
<!-- Checks for Size Violations. --> <!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html --> <!-- See http://checkstyle.sf.net/config_sizes.html -->
<!--
<module name="LineLength">
<property name="max" value="120"/>
</module>
-->
<!-- <module name="MethodLength"/> --> <!-- <module name="MethodLength"/> -->
<!-- <module name="ParameterNumber"/> --> <!-- <module name="ParameterNumber"/> -->
@ -185,6 +180,13 @@
<!-- <module name="TodoComment"/> --> <!-- <module name="TodoComment"/> -->
<module name="UpperEll"/> <module name="UpperEll"/>
<module name="Indentation">
<property name="basicOffset" value="2" />
<property name="braceAdjustment" value="0" />
<property name="caseIndent" value="2" />
<property name="arrayInitIndent" value="2"/>
</module>
</module> </module>
<!-- Support @SuppressWarnings (added in Checkstyle 5.7) --> <!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
@ -195,4 +197,8 @@
<!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties --> <!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties -->
<module name="UniqueProperties"/> <module name="UniqueProperties"/>
<module name="LineLength">
<property name="max" value="120"/>
</module>
</module> </module>

View file

@ -27,7 +27,7 @@ import com.google.gwt.user.client.ui.Widget;
/** /**
* A Generator for Wifi networks. * A Generator for Wifi networks.
* *
* @author Vikram Aggarwal * @author Vikram Aggarwal
* @author Sean Owen * @author Sean Owen
*/ */
@ -49,7 +49,7 @@ public final class WifiGenerator implements GeneratorSource {
w.addKeyPressHandler(keyListener); w.addKeyPressHandler(keyListener);
} }
} }
@Override @Override
public String getName() { public String getName() {
return "Wifi network"; return "Wifi network";
@ -96,7 +96,7 @@ public final class WifiGenerator implements GeneratorSource {
} }
return input.replaceAll("([\\\\:;])", "\\\\$1"); return input.replaceAll("([\\\\:;])", "\\\\$1");
} }
private String getSsidField() throws GeneratorException { private String getSsidField() throws GeneratorException {
String input = ssid.getText(); String input = ssid.getText();
if (input.isEmpty()) { if (input.isEmpty()) {
@ -105,11 +105,11 @@ public final class WifiGenerator implements GeneratorSource {
String parsed = parseTextField("SSID", ssid); String parsed = parseTextField("SSID", ssid);
return quoteHex(parsed); // Android needs hex-like SSIDs quoted or will be read as hex return quoteHex(parsed); // Android needs hex-like SSIDs quoted or will be read as hex
} }
private String getPasswordField() throws GeneratorException { private String getPasswordField() throws GeneratorException {
return parseTextField("Password", password); return parseTextField("Password", password);
} }
private String getNetworkTypeField() { private String getNetworkTypeField() {
return networkType.getValue(networkType.getSelectedIndex()); return networkType.getValue(networkType.getSelectedIndex());
} }
@ -118,7 +118,7 @@ public final class WifiGenerator implements GeneratorSource {
Boolean value = hidden.getValue(); Boolean value = hidden.getValue();
return value != null && value; return value != null && value;
} }
@Override @Override
public Grid getWidget() { public Grid getWidget() {
if (table != null) { if (table != null) {
@ -126,7 +126,7 @@ public final class WifiGenerator implements GeneratorSource {
return table; return table;
} }
table = new Grid(4, 2); table = new Grid(4, 2);
table.setText(0, 0, "SSID"); table.setText(0, 0, "SSID");
table.setWidget(0, 1, ssid); table.setWidget(0, 1, ssid);
table.setText(1, 0, "Password"); table.setText(1, 0, "Password");

View file

@ -122,11 +122,11 @@ final class DoSTracker {
int cores = mxBean.getAvailableProcessors(); int cores = mxBean.getAvailableProcessors();
double loadRatio = loadAvg / cores; double loadRatio = loadAvg / cores;
int newMaxAccessesPerTime = loadRatio > maxLoad ? int newMaxAccessesPerTime = loadRatio > maxLoad ?
Math.min(maxAllowedCount, Math.max(1, maxAccessesPerTime - 1)) : Math.min(maxAllowedCount, Math.max(1, maxAccessesPerTime - 1)) :
Math.max(minDisallowedCount, maxAccessesPerTime); Math.max(minDisallowedCount, maxAccessesPerTime);
log.info(name + ": Load ratio: " + loadRatio + log.info(name + ": Load ratio: " + loadRatio +
" (" + loadAvg + '/' + cores + ") vs " + maxLoad + " (" + loadAvg + '/' + cores + ") vs " + maxLoad +
"; new maxAccessesPerTime: " + newMaxAccessesPerTime); " ; new maxAccessesPerTime: " + newMaxAccessesPerTime);
maxAccessesPerTime = newMaxAccessesPerTime; maxAccessesPerTime = newMaxAccessesPerTime;
} }
} }

View file

@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse;
public final class DecodeServletTestCase extends Assert { public final class DecodeServletTestCase extends Assert {
private static final String IMAGE_DATA_URI = private static final String IMAGE_DATA_URI =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhAQAAAAB/n//CAAAAkklEQVR42mP4DwQNDJjkB4" + "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACEAAAAhAQAAAAB/n//CAAAAkklEQVR42mP4DwQNDJjkB4" +
"E77A0M369N/d7A8CV6rjiQjPMFkWG1QPL7RVGg%2BAfREKCa/5/vA9V/nFSQ3sDwb7/KdiDJqX4dSH4pXN/A8DfyDVD2" + "E77A0M369N/d7A8CV6rjiQjPMFkWG1QPL7RVGg%2BAfREKCa/5/vA9V/nFSQ3sDwb7/KdiDJqX4dSH4pXN/A8DfyDVD2" +
"988HQPUfPVaqA0XKz%2BgD9bIk1AP1fgwvB7KlS9VBdqXbA82PT9AH2fiaH2SXGdDM71fDgeIfhIvKsbkTTAIAKYVr0N" + "988HQPUfPVaqA0XKz%2BgD9bIk1AP1fgwvB7KlS9VBdqXbA82PT9AH2fiaH2SXGdDM71fDgeIfhIvKsbkTTAIAKYVr0N" +
"z5IloAAAAASUVORK5CYII="; "z5IloAAAAASUVORK5CYII=";