aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-10-11 06:59:15 +0900
committerAnton Tananaev <anton.tananaev@gmail.com>2019-10-11 06:59:15 +0900
commitc3aeb5442d41688c9509c286c066cf3efebb52d4 (patch)
tree69e809fc3af744d58f7898bb934b3a21f85b0c6c /src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
parente723dc0f0749dbc0c228c7451990319725303cd4 (diff)
downloadtrackermap-server-c3aeb5442d41688c9509c286c066cf3efebb52d4.tar.gz
trackermap-server-c3aeb5442d41688c9509c286c066cf3efebb52d4.tar.bz2
trackermap-server-c3aeb5442d41688c9509c286c066cf3efebb52d4.zip
Implement Pacific Track protocol
Diffstat (limited to 'src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java')
-rw-r--r--src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
new file mode 100644
index 000000000..ade2804da
--- /dev/null
+++ b/src/test/java/org/traccar/protocol/PacificTrackProtocolDecoderTest.java
@@ -0,0 +1,32 @@
+package org.traccar.protocol;
+
+import io.netty.buffer.Unpooled;
+import org.junit.Test;
+import org.traccar.ProtocolTest;
+
+import static org.junit.Assert.assertEquals;
+
+public class PacificTrackProtocolDecoderTest extends ProtocolTest {
+
+ @Test
+ public void testReadBitExt() {
+
+ assertEquals(0x35, PacificTrackProtocolDecoder.readBitExt(
+ Unpooled.wrappedBuffer(new byte[] { (byte) 0b10110101 })));
+
+ assertEquals(0x135, PacificTrackProtocolDecoder.readBitExt(
+ Unpooled.wrappedBuffer(new byte[] { (byte) 0b00000010, (byte) 0b10110101 })));
+ }
+
+
+ @Test
+ public void testDecode() throws Exception {
+
+ PacificTrackProtocolDecoder decoder = new PacificTrackProtocolDecoder(null);
+
+ verifyPosition(decoder, binary(
+ "fb82e80280883527530900009110818202c0909308990b122519076138fc03b3480205a3e80003a0834dd19fb08112c08f0143000e020000000100000014000101929f806328c0000f4240810a858ce011314334424a57464758444c3533313737330190868102100828cf"));
+
+ }
+
+}