From 06b5113f3d98a44530c2ade6810bc75092fccc31 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 20 Oct 2015 13:59:44 +1300 Subject: Refactor bit utililies class --- test/org/traccar/helper/BitUtilTest.java | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/org/traccar/helper/BitUtilTest.java b/test/org/traccar/helper/BitUtilTest.java index dbe3852b7..4aa295e12 100644 --- a/test/org/traccar/helper/BitUtilTest.java +++ b/test/org/traccar/helper/BitUtilTest.java @@ -13,11 +13,23 @@ public class BitUtilTest { } @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)); + public void testBetween() { + Assert.assertEquals(0, BitUtil.between(0, 0, 0)); + Assert.assertEquals(1, BitUtil.between(1, 0, 1)); + Assert.assertEquals(2, BitUtil.between(2, 0, 2)); + Assert.assertEquals(2, BitUtil.between(6, 0, 2)); + } + + @Test + public void testFrom() { + Assert.assertEquals(1, BitUtil.from(1, 0)); + Assert.assertEquals(0, BitUtil.from(1, 1)); + } + + @Test + public void testTo() { + Assert.assertEquals(2, BitUtil.to(2, 2)); + Assert.assertEquals(0, BitUtil.to(2, 1)); } } -- cgit v1.2.3