aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/helper/BitUtilTest.java
blob: dbe3852b780c07e8f3d0dbd64c248534bf61d458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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));
    }

}