Code39WriterTestCase.java (zxing-zxing-3.4.0) | : | Code39WriterTestCase.java (zxing-zxing-3.4.1) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | |||
* limitations under the License. | * limitations under the License. | |||
*/ | */ | |||
package com.google.zxing.oned; | package com.google.zxing.oned; | |||
import com.google.zxing.BarcodeFormat; | import com.google.zxing.BarcodeFormat; | |||
import com.google.zxing.WriterException; | ||||
import com.google.zxing.common.BitMatrix; | import com.google.zxing.common.BitMatrix; | |||
import com.google.zxing.common.BitMatrixTestCase; | import com.google.zxing.common.BitMatrixTestCase; | |||
import org.junit.Assert; | import org.junit.Assert; | |||
import org.junit.Test; | import org.junit.Test; | |||
/** | /** | |||
* Tests {@link Code39Writer}. | * Tests {@link Code39Writer}. | |||
*/ | */ | |||
public final class Code39WriterTestCase extends Assert { | public final class Code39WriterTestCase extends Assert { | |||
@Test | @Test | |||
public void testEncode() throws WriterException { | public void testEncode() { | |||
doTest("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", | doTest("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", | |||
"00000100101101101011010100101101011010010110110110100101010101100101 1011010110010101" + | "00000100101101101011010100101101011010010110110110100101010101100101 1011010110010101" + | |||
"01101100101010101001101101101010011010101101001101010101100110101101 0101001101011010" + | "01101100101010101001101101101010011010101101001101010101100110101101 0101001101011010" + | |||
"10011011011010100101010110100110110101101001010110110100101010101100 1101101010110010" + | "10011011011010100101010110100110110101101001010110110100101010101100 1101101010110010" + | |||
"10110101100101010110110010110010101011010011010101101100110101010100 1011010110110010" + | "10110101100101010110110010110010101011010011010101101100110101010100 1011010110110010" + | |||
"11010101001101101010101001101101011010010101101011001010110110110010 1010101001101011" + | "11010101001101101010101001101101011010010101101011001010110110110010 1010101001101011" + | |||
"01101001101010101100110101010100101101101101001011010101100101101010 010110110100000"); | "01101001101010101100110101010100101101101101001011010101100101101010 010110110100000"); | |||
// extended mode blocks | // extended mode blocks | |||
doTest("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u00 0e\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\u00 0e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b \u001c\u001d\u001e\u001f", | |||
skipping to change at line 89 | skipping to change at line 88 | |||
"10010100100101011010011010100101001001010101100110101001010010010110 1010100110100101" + | "10010100100101011010011010100101001001010101100110101001010010010110 1010100110100101" + | |||
"00100101011010100110100101001001011011010100101001010010010101011010 0110100101001001" + | "00100101011010100110100101001001011011010100101001010010010101011010 0110100101001001" + | |||
"01101011010010100101001001010110110100101001010010010101010110011010 0101001001011010" + | "01101011010010100101001001010110110100101001010010010101010110011010 0101001001011010" + | |||
"10110010100101001001010110101100101001010010010101011011001010010100 1001011001010101" + | "10110010100101001001010110101100101001010010010101011011001010010100 1001011001010101" + | |||
"10100101001001010011010101101001010010010110011010101010010100100101 0010110101101001" + | "10100101001001010011010101101001010010010110011010101010010100100101 0010110101101001" + | |||
"01001001011001011010101001010010010100110110101010100100100101011011 0100101010010010" + | "01001001011001011010101001010010010100110110101010100100100101011011 0100101010010010" + | |||
"01010101011001101010010010010110101011001010100100100101011010110010 1010010010010101" + | "01010101011001101010010010010110101011001010100100100101011010110010 1010010010010101" + | |||
"011011001010010110110100000"); | "011011001010010110110100000"); | |||
} | } | |||
private static void doTest(String input, CharSequence expected) throws WriterE xception { | private static void doTest(String input, CharSequence expected) { | |||
BitMatrix result = new Code39Writer().encode(input, BarcodeFormat.CODE_39, 0 , 0); | BitMatrix result = new Code39Writer().encode(input, BarcodeFormat.CODE_39, 0 , 0); | |||
assertEquals(input, expected, BitMatrixTestCase.matrixToString(result)); | assertEquals(input, expected, BitMatrixTestCase.matrixToString(result)); | |||
} | } | |||
} | } | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added |