blob: 3b35212139caf0f258f073fc77d91c5dbb511c3c (
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.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.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));
}
}
|