X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=core%2Ftest%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2Fdecoder%2FFormatInformationTestCase.java;fp=core%2Ftest%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2Fdecoder%2FFormatInformationTestCase.java;h=c3c00534b0230f310a7cd2a791328c8c9de9848c;hb=e5d03a79a458340b69a57914a352f0a8841cdf69;hp=6bf1ef7a34452f59a4b1f936df07a39212e4457c;hpb=a932cce57fabafd18a5db770f2c87afbd72e31b9;p=zxing.git diff --git a/core/test/src/com/google/zxing/qrcode/decoder/FormatInformationTestCase.java b/core/test/src/com/google/zxing/qrcode/decoder/FormatInformationTestCase.java index 6bf1ef7a..c3c00534 100644 --- a/core/test/src/com/google/zxing/qrcode/decoder/FormatInformationTestCase.java +++ b/core/test/src/com/google/zxing/qrcode/decoder/FormatInformationTestCase.java @@ -16,16 +16,18 @@ package com.google.zxing.qrcode.decoder; -import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; /** * @author Sean Owen */ -public final class FormatInformationTestCase extends TestCase { +public final class FormatInformationTestCase extends Assert { private static final int MASKED_TEST_FORMAT_INFO = 0x2BED; private static final int UNMASKED_TEST_FORMAT_INFO = MASKED_TEST_FORMAT_INFO ^ 0x5412; + @Test public void testBitsDiffering() { assertEquals(0, FormatInformation.numBitsDiffering(1, 1)); assertEquals(1, FormatInformation.numBitsDiffering(0, 2)); @@ -33,6 +35,7 @@ public final class FormatInformationTestCase extends TestCase { assertEquals(32, FormatInformation.numBitsDiffering(-1, 0)); } + @Test public void testDecode() { // Normal case FormatInformation expected = @@ -44,6 +47,7 @@ public final class FormatInformationTestCase extends TestCase { FormatInformation.decodeFormatInformation(UNMASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO)); } + @Test public void testDecodeWithBitDifference() { FormatInformation expected = FormatInformation.decodeFormatInformation(MASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO); @@ -58,6 +62,7 @@ public final class FormatInformationTestCase extends TestCase { MASKED_TEST_FORMAT_INFO ^ 0x0F, MASKED_TEST_FORMAT_INFO ^ 0x0F)); } + @Test public void testDecodeWithMisread() { FormatInformation expected = FormatInformation.decodeFormatInformation(MASKED_TEST_FORMAT_INFO, MASKED_TEST_FORMAT_INFO);