"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/com/google/zxing/pdf417/decoder/ec/ErrorCorrectionTestCase.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Info: Project is in maintenance mode (no active development).

ErrorCorrectionTestCase.java  (zxing-zxing-3.4.1):ErrorCorrectionTestCase.java  (zxing-zxing-3.5.0)
skipping to change at line 21 skipping to change at line 21
* 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.pdf417.decoder.ec; package com.google.zxing.pdf417.decoder.ec;
import com.google.zxing.ChecksumException; import com.google.zxing.ChecksumException;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.util.Random; import java.util.Random;
/** /**
* @author Sean Owen * @author Sean Owen
*/ */
public final class ErrorCorrectionTestCase extends AbstractErrorCorrectionTestCa se { public final class ErrorCorrectionTestCase extends AbstractErrorCorrectionTestCa se {
private static final int[] PDF417_TEST = { private static final int[] PDF417_TEST = {
skipping to change at line 88 skipping to change at line 87
Random random = getRandom(); Random random = getRandom();
corrupt(received, MAX_ERRORS + 1, random); corrupt(received, MAX_ERRORS + 1, random);
try { try {
checkDecode(received); checkDecode(received);
fail("Should not have decoded"); fail("Should not have decoded");
} catch (ChecksumException ce) { } catch (ChecksumException ce) {
// good // good
} }
} }
@Ignore("Erasures not implemented yet")
@Test
public void testMaxErasures() throws ChecksumException {
Random random = getRandom();
for (int test : PDF417_TEST) { // # iterations is kind of arbitrary
int[] received = PDF417_TEST_WITH_EC.clone();
int[] erasures = erase(received, MAX_ERASURES, random);
checkDecode(received, erasures);
}
}
@Ignore("Erasures not implemented yet")
@Test
public void testTooManyErasures() {
Random random = getRandom();
int[] received = PDF417_TEST_WITH_EC.clone();
int[] erasures = erase(received, MAX_ERASURES + 1, random);
try {
checkDecode(received, erasures);
fail("Should not have decoded");
} catch (ChecksumException ce) {
// good
}
}
private void checkDecode(int[] received) throws ChecksumException { private void checkDecode(int[] received) throws ChecksumException {
checkDecode(received, new int[0]); checkDecode(received, new int[0]);
} }
private void checkDecode(int[] received, int[] erasures) throws ChecksumExcept ion { private void checkDecode(int[] received, int[] erasures) throws ChecksumExcept ion {
ec.decode(received, ECC_BYTES, erasures); ec.decode(received, ECC_BYTES, erasures);
for (int i = 0; i < PDF417_TEST.length; i++) { for (int i = 0; i < PDF417_TEST.length; i++) {
assertEquals(received[i], PDF417_TEST[i]); assertEquals(received[i], PDF417_TEST[i]);
} }
} }
 End of changes. 2 change blocks. 
26 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)