1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Tiny test for parsing date,time,tz

This commit is contained in:
cpfeiffer 2017-11-06 23:21:04 +01:00
parent a58e3f66ce
commit 99710e7db3

View File

@ -0,0 +1,25 @@
package nodomain.freeyourgadget.gadgetbridge.test;
import org.junit.Test;
import java.util.GregorianCalendar;
import nodomain.freeyourgadget.gadgetbridge.service.btle.BLETypeConversions;
import static org.junit.Assert.assertTrue;
public class BLETypeConversionsTest extends TestBase {
@Test
public void testTimeParsing() {
byte[] requested = new byte[] {
(byte) 0xe1, 0x07, 0x0a, 0x1d, 0x00, 0x1c, 0x00,0x08
};
byte[] received = new byte[] {
(byte) 0xe1, 0x07, 0x0a, 0x1c, 0x17, 0x1c, 0x00, 0x04
};
GregorianCalendar calRequested = BLETypeConversions.rawBytesToCalendar(requested, false);
GregorianCalendar calReceived = BLETypeConversions.rawBytesToCalendar(received, false);
assertTrue(calRequested.getTime().equals(calReceived.getTime()));
}
}