aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-28 10:28:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-28 10:28:58 +1200
commit8ee694af98493830380e5faf96d43752002ca634 (patch)
tree0fd6be2954a2b9ad1976f7bba2461a86ca7c81b1 /test
parentea0a523ef676310526055b1ae381387868afd738 (diff)
downloadtraccar-server-8ee694af98493830380e5faf96d43752002ca634.tar.gz
traccar-server-8ee694af98493830380e5faf96d43752002ca634.tar.bz2
traccar-server-8ee694af98493830380e5faf96d43752002ca634.zip
Implement bit utility class
Diffstat (limited to 'test')
-rw-r--r--test/org/traccar/helper/BitUtilTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/org/traccar/helper/BitUtilTest.java b/test/org/traccar/helper/BitUtilTest.java
new file mode 100644
index 000000000..dbe3852b7
--- /dev/null
+++ b/test/org/traccar/helper/BitUtilTest.java
@@ -0,0 +1,23 @@
+package org.traccar.helper;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class BitUtilTest {
+
+ @Test
+ public void testCheck() {
+ Assert.assertFalse(BitUtil.check(0, 0));
+ Assert.assertTrue(BitUtil.check(1, 0));
+ Assert.assertFalse(BitUtil.check(2, 0));
+ }
+
+ @Test
+ public void testRange() {
+ Assert.assertEquals(0, BitUtil.range(0, 0, 0));
+ Assert.assertEquals(1, BitUtil.range(1, 0, 1));
+ Assert.assertEquals(2, BitUtil.range(2, 0, 2));
+ Assert.assertEquals(2, BitUtil.range(6, 0, 2));
+ }
+
+}