Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Dec 22, 2023
1 parent cee02e2 commit c858db1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
12 changes: 7 additions & 5 deletions src/test/java/ru/r2cloud/lora/loraat/gatt/GattServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void testInvalidArguments() throws Exception {

byte[] empty = readValue(app.getSource(), application, GattServer.SCHEDULE_CHARACTERISTIC_UUID);
assertEquals(0, empty.length);

LoraFrame frame = createFrame();
writeValue(app.getSource(), application, serialize(frame), GattServer.SCHEDULE_CHARACTERISTIC_UUID);
assertTrue(device.getFrames().isEmpty());
Expand Down Expand Up @@ -221,8 +221,8 @@ private void assertLoraRequest(Transmitter transmitter, long startTime, long end
assertEquals(startTime, actual.getStartTimeMillis());
assertEquals(endTime, actual.getEndTimeMillis());
assertEquals(time, actual.getCurrentTime());
assertEquals(transmitter.getFrequency() / 1_000_000.0f, actual.getFrequency(), 0.0f);
assertEquals(transmitter.getLoraBandwidth() / 1_000.0f, actual.getLoraBandwidth(), 0.0f);
assertEquals(transmitter.getFrequency(), actual.getFrequency());
assertEquals(transmitter.getLoraBandwidth(), actual.getLoraBandwidth());
assertEquals(transmitter.getLoraSpreadFactor(), actual.getLoraSpreadFactor());
assertEquals(transmitter.getLoraCodingRate(), actual.getLoraCodingRate());
assertEquals(transmitter.getLoraSyncword(), actual.getLoraSyncword());
Expand All @@ -242,8 +242,8 @@ private static LoraBleObservationRequest deserialize(byte[] readValue) throws IO
result.setStartTimeMillis(dis.readLong());
result.setEndTimeMillis(dis.readLong());
result.setCurrentTime(dis.readLong());
result.setFrequency(dis.readFloat());
result.setLoraBandwidth(dis.readFloat());
result.setFrequency(dis.readLong());
result.setLoraBandwidth(dis.readInt());
result.setLoraSpreadFactor(dis.readUnsignedByte());
result.setLoraCodingRate(dis.readUnsignedByte());
result.setLoraSyncword(dis.readUnsignedByte());
Expand All @@ -254,6 +254,8 @@ private static LoraBleObservationRequest deserialize(byte[] readValue) throws IO
result.setLoraCrc(dis.readUnsignedByte());
result.setLoraExplicitHeader(dis.readUnsignedByte());
result.setBeaconSizeBytes(dis.readUnsignedByte());
dis.skipBytes(2); // ocp
dis.skipBytes(1); // tx pin
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ public class LoraBleObservationRequest {
private long startTimeMillis;
private long endTimeMillis;
private long currentTime;
private float frequency;
private float loraBandwidth;
private long frequency;
private long loraBandwidth;
private int loraSpreadFactor;
private int loraCodingRate;
private int loraSyncword;
Expand Down Expand Up @@ -42,22 +42,22 @@ public void setCurrentTime(long currentTime) {
this.currentTime = currentTime;
}

public float getFrequency() {
public long getFrequency() {
return frequency;
}

public void setFrequency(float frequency) {
public void setFrequency(long frequency) {
this.frequency = frequency;
}

public float getLoraBandwidth() {
public long getLoraBandwidth() {
return loraBandwidth;
}

public void setLoraBandwidth(float loraBandwidth) {
public void setLoraBandwidth(long loraBandwidth) {
this.loraBandwidth = loraBandwidth;
}

public int getLoraSpreadFactor() {
return loraSpreadFactor;
}
Expand Down

0 comments on commit c858db1

Please sign in to comment.