This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit b8df5f07005e43383aea5ae9bdf791fc12910b0e Author: Sebastian Rühl <[email protected]> AuthorDate: Thu Mar 15 11:27:42 2018 +0100 added test for digest util to prove that implementation works for lists --- .../apache/plc4x/java/ads/protocol/util/DigestUtilTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java index f2b5917..73f3328 100644 --- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java +++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java @@ -18,14 +18,24 @@ */ package org.apache.plc4x.java.ads.protocol.util; +import io.netty.buffer.Unpooled; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import java.util.stream.IntStream; +import static org.junit.Assert.assertEquals; + public class DigestUtilTest { @Test + public void sameCalculation() throws Exception { + assertEquals( + DigestUtil.calculateCrc16(new byte[]{47, 99}), + DigestUtil.calculateCrc16(() -> Unpooled.wrappedBuffer(new byte[]{47}), () -> Unpooled.wrappedBuffer(new byte[]{99}))); + } + + @Test public void displayValue() throws Exception { Object[] crcs = IntStream.range(0, 256) .map(value -> DigestUtil.calculateCrc16(new byte[]{(byte) value})) -- To stop receiving notification emails like this one, please contact [email protected].
