diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-18 23:33:27 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-18 23:33:27 +1300 |
commit | 9d548e3aab48e9f13c51c5f974b06e29db8d1d0c (patch) | |
tree | df380877a6806d8949107fe8b89a7a210fcd5f15 /test/org/traccar/helper | |
parent | b580bf533b6f74749b96adf3652f5584425abe69 (diff) | |
download | trackermap-server-9d548e3aab48e9f13c51c5f974b06e29db8d1d0c.tar.gz trackermap-server-9d548e3aab48e9f13c51c5f974b06e29db8d1d0c.tar.bz2 trackermap-server-9d548e3aab48e9f13c51c5f974b06e29db8d1d0c.zip |
Implement bit buffer utility
Diffstat (limited to 'test/org/traccar/helper')
-rw-r--r-- | test/org/traccar/helper/BitBufferTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/org/traccar/helper/BitBufferTest.java b/test/org/traccar/helper/BitBufferTest.java new file mode 100644 index 000000000..c2abad36d --- /dev/null +++ b/test/org/traccar/helper/BitBufferTest.java @@ -0,0 +1,23 @@ +package org.traccar.helper; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class BitBufferTest { + + @Test + public void test() { + BitBuffer buffer = new BitBuffer(); + + buffer.write(0b100100); + buffer.write(0b110110); + buffer.write(0b111111); + buffer.write(0b111111); + + assertEquals(0b100, buffer.readUnsigned(3)); + assertEquals(-7, buffer.readSigned(4)); + assertEquals(0b10110, buffer.readUnsigned(5)); + } + +} |