summaryrefslogtreecommitdiff
path: root/core/src/test/java
diff options
context:
space:
mode:
authorMakKi (makki_d) <d.makiuchi+gh@gmail.com>2018-11-02 18:51:39 +0300
committerSean Owen <srowen@gmail.com>2018-11-02 18:51:39 +0300
commit58feb44536da804e8732181e7ccbce5e94ff7d28 (patch)
tree8f4eba676f07f067c861732ebd3eb694b8a60362 /core/src/test/java
parent1f4aaad628576d32ec281edc0e64f4b5e18c2b92 (diff)
downloadzxing-58feb44536da804e8732181e7ccbce5e94ff7d28.tar.xz
fix code93 extended character decoder (#1101)
Diffstat (limited to 'core/src/test/java')
-rw-r--r--core/src/test/java/com/google/zxing/oned/Code93ReaderTestCase.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/core/src/test/java/com/google/zxing/oned/Code93ReaderTestCase.java b/core/src/test/java/com/google/zxing/oned/Code93ReaderTestCase.java
new file mode 100644
index 000000000..48a0f5c03
--- /dev/null
+++ b/core/src/test/java/com/google/zxing/oned/Code93ReaderTestCase.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2018 ZXing authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.zxing.oned;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.common.BitArray;
+import com.google.zxing.ChecksumException;
+import com.google.zxing.FormatException;
+import com.google.zxing.NotFoundException;
+import com.google.zxing.Result;
+
+/**
+ * @author Daisuke Makiuchi
+ */
+public final class Code93ReaderTestCase extends Assert {
+
+ @Test
+ public void testDecode() throws Exception {
+ doTest("Code93!\n$%/+ :\u001b;[{\u007f\u0000@`\u007f\u007f\u007f",
+ "0000001010111101101000101001100101001011001001100101100101001001100101100100101000010101010000101110101101101010001001001101001101001110010101101011101011011101011101101110100101110101101001110101110110101101010001110110101100010101110110101000110101110110101000101101110110101101001101110110101100101101110110101100110101110110101011011001110110101011001101110110101001101101110110101001110101001100101101010001010111101111");
+ }
+
+ private static void doTest(String expectedResult, String encodedResult) throws FormatException, ChecksumException, NotFoundException {
+ Code93Reader sut = new Code93Reader();
+ BitMatrix matrix = BitMatrix.parse(encodedResult, "1", "0");
+ BitArray row = new BitArray(matrix.getWidth());
+ matrix.getRow(0, row);
+ Result result = sut.decodeRow(0, row, null);
+ assertEquals(expectedResult, result.getText());
+ }
+
+}