aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/helper
diff options
context:
space:
mode:
authorIvan Muratov <binakot@gmail.com>2017-07-13 08:42:17 +0300
committerIvan Muratov <binakot@gmail.com>2017-07-13 08:42:17 +0300
commit358b591bc457786927ac1466e10181bbffbcf56b (patch)
treec55745c3ebf2c09acd2d784f828c79e2f3e588c6 /test/org/traccar/helper
parent6e70a873886b366980423e448808b60c624e4047 (diff)
downloadtrackermap-server-358b591bc457786927ac1466e10181bbffbcf56b.tar.gz
trackermap-server-358b591bc457786927ac1466e10181bbffbcf56b.tar.bz2
trackermap-server-358b591bc457786927ac1466e10181bbffbcf56b.zip
Replace MODULO256 checksum method.
Added covering tests.
Diffstat (limited to 'test/org/traccar/helper')
-rw-r--r--test/org/traccar/helper/ChecksumTest.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/org/traccar/helper/ChecksumTest.java b/test/org/traccar/helper/ChecksumTest.java
index c37eda88d..737b65c62 100644
--- a/test/org/traccar/helper/ChecksumTest.java
+++ b/test/org/traccar/helper/ChecksumTest.java
@@ -4,6 +4,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Assert;
import org.junit.Test;
+import org.traccar.protocol.Arnavi4ProtocolDecoder;
import java.nio.charset.StandardCharsets;
@@ -28,4 +29,11 @@ public class ChecksumTest {
Assert.assertEquals(0, Checksum.luhn(63070019470771L));
}
+ @Test
+ public void testModulo256() {
+ Assert.assertEquals(0x00, Checksum.modulo256((byte)0x00));
+ Assert.assertEquals(0x00, Checksum.modulo256((byte)0x00, (byte)0x00, (byte)0x00));
+ Assert.assertEquals(0x06, Checksum.modulo256((byte)0x01, (byte)0x02, (byte)0x03));
+ }
+
}