X-Git-Url: http://git.rot13.org/?p=zxing.git;a=blobdiff_plain;f=core%2Ftest%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fqrcode%2Fdecoder%2FDataMaskTestCase.java;h=e8bda1665c849e7366f8ffc9a8735aeb55b9dbb8;hp=c7df2c2c0c51d7cd72928162a87ca38744d6e2d5;hb=e5d03a79a458340b69a57914a352f0a8841cdf69;hpb=7d63fd5b1c4e8136b4ca5833445f9e587c85a400 diff --git a/core/test/src/com/google/zxing/qrcode/decoder/DataMaskTestCase.java b/core/test/src/com/google/zxing/qrcode/decoder/DataMaskTestCase.java index c7df2c2c..e8bda166 100644 --- a/core/test/src/com/google/zxing/qrcode/decoder/DataMaskTestCase.java +++ b/core/test/src/com/google/zxing/qrcode/decoder/DataMaskTestCase.java @@ -17,13 +17,15 @@ package com.google.zxing.qrcode.decoder; import com.google.zxing.common.BitMatrix; -import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; /** * @author Sean Owen */ -public final class DataMaskTestCase extends TestCase { +public final class DataMaskTestCase extends Assert { + @Test public void testMask0() { testMaskAcrossDimensions(0, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -32,6 +34,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask1() { testMaskAcrossDimensions(1, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -40,6 +43,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask2() { testMaskAcrossDimensions(2, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -48,6 +52,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask3() { testMaskAcrossDimensions(3, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -56,6 +61,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask4() { testMaskAcrossDimensions(4, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -64,6 +70,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask5() { testMaskAcrossDimensions(5, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -72,6 +79,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask6() { testMaskAcrossDimensions(6, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -80,6 +88,7 @@ public final class DataMaskTestCase extends TestCase { }); } + @Test public void testMask7() { testMaskAcrossDimensions(7, new MaskCondition() { public boolean isMasked(int i, int j) { @@ -88,8 +97,7 @@ public final class DataMaskTestCase extends TestCase { }); } - private void testMaskAcrossDimensions(int reference, - MaskCondition condition) { + private static void testMaskAcrossDimensions(int reference, MaskCondition condition) { DataMask mask = DataMask.forReference(reference); for (int version = 1; version <= 40; version++) { int dimension = 17 + 4 * version; @@ -97,20 +105,20 @@ public final class DataMaskTestCase extends TestCase { } } - private void testMask(DataMask mask, int dimension, MaskCondition condition) { + private static void testMask(DataMask mask, int dimension, MaskCondition condition) { BitMatrix bits = new BitMatrix(dimension); - mask.unmaskBitMatrix(bits.getBits(), dimension); + mask.unmaskBitMatrix(bits, dimension); for (int i = 0; i < dimension; i++) { for (int j = 0; j < dimension; j++) { assertEquals( "(" + i + ',' + j + ')', condition.isMasked(i, j), - bits.get(i, j)); + bits.get(j, i)); } } } - private static interface MaskCondition { + private interface MaskCondition { boolean isMasked(int i, int j); }