mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fixed two more tests.
git-svn-id: https://zxing.googlecode.com/svn/trunk@731 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
0a1a550a0f
commit
dbe7f8aa85
|
@ -165,7 +165,7 @@ public final class QRCode {
|
||||||
// Return debug String.
|
// Return debug String.
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
result.append("<<QRCode\n");
|
result.append("<<\n");
|
||||||
result.append(" mode: ");
|
result.append(" mode: ");
|
||||||
result.append(ModeToString(mode_));
|
result.append(ModeToString(mode_));
|
||||||
result.append("\n ec_level: ");
|
result.append("\n ec_level: ");
|
||||||
|
@ -187,10 +187,10 @@ public final class QRCode {
|
||||||
if (matrix_ == null) {
|
if (matrix_ == null) {
|
||||||
result.append("\n matrix: null");
|
result.append("\n matrix: null");
|
||||||
} else {
|
} else {
|
||||||
result.append("\n matrix:");
|
result.append("\n matrix:\n");
|
||||||
result.append(matrix_.toString());
|
result.append(matrix_.toString());
|
||||||
}
|
}
|
||||||
result.append("\n>>\n");
|
result.append(">>\n");
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -511,31 +511,37 @@ public final class EncoderTestCase extends TestCase {
|
||||||
{
|
{
|
||||||
final byte[] data_bytes = {32, 65, (byte)205, 69, 41, (byte)220, 46, (byte)128, (byte)236};
|
final byte[] data_bytes = {32, 65, (byte)205, 69, 41, (byte)220, 46, (byte)128, (byte)236};
|
||||||
ByteArray ec_bytes = Encoder.GenerateECBytes(new ByteArray(data_bytes), 17);
|
ByteArray ec_bytes = Encoder.GenerateECBytes(new ByteArray(data_bytes), 17);
|
||||||
final byte[] expected = {
|
final int[] expected = {
|
||||||
42, (byte)159, 74, (byte)221, (byte)244, (byte)169, (byte)239, (byte)150, (byte)138, 70,
|
42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61
|
||||||
(byte)237, 85, (byte)224, 96, 74, (byte)219, 61
|
|
||||||
};
|
};
|
||||||
assertEquals(new ByteArray(expected), ec_bytes);
|
assertEquals(expected.length, ec_bytes.size());
|
||||||
|
for (int x = 0; x < expected.length; x++) {
|
||||||
|
assertEquals(expected[x], ec_bytes.at(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
final byte[] data_bytes = {67, 70, 22, 38, 54, 70, 86, 102, 118,
|
final byte[] data_bytes = {67, 70, 22, 38, 54, 70, 86, 102, 118,
|
||||||
(byte)134, (byte)150, (byte)166, (byte)182, (byte)198, (byte)214};
|
(byte)134, (byte)150, (byte)166, (byte)182, (byte)198, (byte)214};
|
||||||
ByteArray ec_bytes = Encoder.GenerateECBytes(new ByteArray(data_bytes), 18);
|
ByteArray ec_bytes = Encoder.GenerateECBytes(new ByteArray(data_bytes), 18);
|
||||||
final byte[] expected = {
|
final int[] expected = {
|
||||||
(byte)175, 80, (byte)155, 64, (byte)178, 45, (byte)214, (byte)233, 65, (byte)209, 12,
|
175, 80, 155, 64, 178, 45, 214, 233, 65, 209, 12, 155, 117, 31, 140, 214, 27, 187
|
||||||
(byte)155, 117, 31, (byte)140, (byte)214, 27, (byte)187
|
|
||||||
};
|
};
|
||||||
assertEquals(new ByteArray(expected), ec_bytes);
|
assertEquals(expected.length, ec_bytes.size());
|
||||||
|
for (int x = 0; x < expected.length; x++) {
|
||||||
|
assertEquals(expected[x], ec_bytes.at(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
// High-order zero cofficient case.
|
// High-order zero cofficient case.
|
||||||
final byte[] data_bytes = {32, 49, (byte)205, 69, 42, 20, 0, (byte)236, 17};
|
final byte[] data_bytes = {32, 49, (byte)205, 69, 42, 20, 0, (byte)236, 17};
|
||||||
ByteArray ec_bytes = Encoder.GenerateECBytes(new ByteArray(data_bytes), 17);
|
ByteArray ec_bytes = Encoder.GenerateECBytes(new ByteArray(data_bytes), 17);
|
||||||
final byte[] expected = {
|
final int[] expected = {
|
||||||
0, 3, (byte)130, (byte)179, (byte)194, 0, 55, (byte)211, 110, 79, 98, 72, (byte)170, 96,
|
0, 3, 130, 179, 194, 0, 55, 211, 110, 79, 98, 72, 170, 96, 211, 137, 213
|
||||||
(byte)211, (byte)137, (byte)213
|
|
||||||
};
|
};
|
||||||
assertEquals(new ByteArray(expected), ec_bytes);
|
assertEquals(expected.length, ec_bytes.size());
|
||||||
|
for (int x = 0; x < expected.length; x++) {
|
||||||
|
assertEquals(expected[x], ec_bytes.at(x));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue