Code93WriterTestCase.java (zxing-zxing-3.4.0) | : | Code93WriterTestCase.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 Code93Writer}. | * Tests {@link Code93Writer}. | |||
*/ | */ | |||
public final class Code93WriterTestCase extends Assert { | public final class Code93WriterTestCase extends Assert { | |||
@Test | @Test | |||
public void testEncode() throws WriterException { | public void testEncode() { | |||
doTest("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", | doTest("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", | |||
"00000101011110110101000110100100110100010110010100110010010110001010 1011010001011001" + | "00000101011110110101000110100100110100010110010100110010010110001010 1011010001011001" + | |||
"00101100010100110100100011010101011000101001100101000110100101100100 0101101101101001" + | "00101100010100110100100011010101011000101001100101000110100101100100 0101101101101001" + | |||
"10110010110101100110100110110010110110011010101101100101100110100110 1101001110101000" + | "10110010110101100110100110110010110110011010101101100101100110100110 1101001110101000" + | |||
"10100101001000101000100101000010100101000100100100100100010101010000 1000100101000010" + | "10100101001000101000100101000010100101000100100100100100010101010000 1000100101000010" + | |||
"10100111010101000010101011110100000"); | "10100111010101000010101011110100000"); | |||
doTest("\u0000\u0001\u001a\u001b\u001f $%+!,09:;@AZ[_`az{\u007f", | doTest("\u0000\u0001\u001a\u001b\u001f $%+!,09:;@AZ[_`az{\u007f", | |||
"00000" + "101011110" + | "00000" + "101011110" + | |||
"111011010" + "110010110" + "100100110" + "110101000" + // bU aA | "111011010" + "110010110" + "100100110" + "110101000" + // bU aA | |||
skipping to change at line 57 | skipping to change at line 56 | |||
"111010110" + "100111010" + "111011010" + "110001010" + // cZ bF | "111010110" + "100111010" + "111011010" + "110001010" + // cZ bF | |||
"111011010" + "110011010" + "110101000" + "100111010" + // bV A Z | "111011010" + "110011010" + "110101000" + "100111010" + // bV A Z | |||
"111011010" + "100011010" + "111011010" + "100101100" + // bK bO | "111011010" + "100011010" + "111011010" + "100101100" + // bK bO | |||
"111011010" + "101101100" + "100110010" + "110101000" + // bW dA | "111011010" + "101101100" + "100110010" + "110101000" + // bW dA | |||
"100110010" + "100111010" + "111011010" + "100010110" + // dZ bP | "100110010" + "100111010" + "111011010" + "100010110" + // dZ bP | |||
"111011010" + "110100110" + // bT | "111011010" + "110100110" + // bT | |||
"110100010" + "110101100" + // checksum: 12 28 | "110100010" + "110101100" + // checksum: 12 28 | |||
"101011110" + "100000"); | "101011110" + "100000"); | |||
} | } | |||
private static void doTest(String input, CharSequence expected) throws WriterE xception { | private static void doTest(String input, CharSequence expected) { | |||
BitMatrix result = new Code93Writer().encode(input, BarcodeFormat.CODE_93, 0 , 0); | BitMatrix result = new Code93Writer().encode(input, BarcodeFormat.CODE_93, 0 , 0); | |||
assertEquals(expected, BitMatrixTestCase.matrixToString(result)); | assertEquals(expected, BitMatrixTestCase.matrixToString(result)); | |||
} | } | |||
@Test | @Test | |||
public void testConvertToExtended() { | public void testConvertToExtended() { | |||
// non-extended chars are not changed. | // non-extended chars are not changed. | |||
String src = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; | String src = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; | |||
String dst = Code93Writer.convertToExtended(src); | String dst = Code93Writer.convertToExtended(src); | |||
assertEquals(src, dst); | assertEquals(src, dst); | |||
End of changes. 3 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added |