aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/helper
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/traccar/helper')
-rw-r--r--src/test/java/org/traccar/helper/ChecksumTest.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/java/org/traccar/helper/ChecksumTest.java b/src/test/java/org/traccar/helper/ChecksumTest.java
index 5737b9ff5..ff48527bc 100644
--- a/src/test/java/org/traccar/helper/ChecksumTest.java
+++ b/src/test/java/org/traccar/helper/ChecksumTest.java
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import static org.junit.Assert.assertEquals;
@@ -36,4 +37,13 @@ public class ChecksumTest {
assertEquals(0, Checksum.luhn(63070019470771L));
}
+ @Test
+ public void testModulo256() {
+ assertEquals(0x00, Checksum.modulo256(ByteBuffer.wrap(new byte[] {0x00})));
+ assertEquals(0x00, Checksum.modulo256(ByteBuffer.wrap(new byte[] {0x00, 0x00, 0x00})));
+ assertEquals(0xca, Checksum.modulo256(ByteBuffer.wrap(new byte[] {0x77, 0x77, 0x77, 0x77, 0x77, 0x77})));
+
+
+ }
+
}