From 8ee694af98493830380e5faf96d43752002ca634 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 28 Jun 2015 10:28:58 +1200 Subject: Implement bit utility class --- test/org/traccar/helper/BitUtilTest.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/org/traccar/helper/BitUtilTest.java (limited to 'test') 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)); + } + +} -- cgit v1.2.3