Skip to content

Commit

Permalink
- Test case updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjzazuet committed Jul 4, 2024
1 parent 9cbb9fa commit 1d87505
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
10 changes: 0 additions & 10 deletions tk-sdr/src/main/java/io/vacco/tokoeka/util/TkCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

import io.vacco.tokoeka.schema.TkModulation;
import java.util.Arrays;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static io.vacco.tokoeka.schema.TkConstants.badp;
import static io.vacco.tokoeka.schema.TkConstants.too_busy;
import static io.vacco.tokoeka.util.TkPair.*;
import static java.lang.String.format;

Expand Down Expand Up @@ -130,11 +127,4 @@ public static String setKeepAlive() {
return set(ks("keepalive"));
}

public static boolean isKiwiOk(String key, String value) {
if (key == null) { // not a control message
return true;
}
return Objects.equals(key, badp) && Objects.equals(value, "0");
}

}
5 changes: 4 additions & 1 deletion tk-sdr/src/test/java/TkSocketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public class TkSocketTest {
}))
.withControlPin((code, key, value, remote, e) -> {
log.info("control event: {} [{}] [{}] {}", code, key, value, remote, e);
if (!TkCommand.isKiwiOk(key, value) || code == 1006) {
var isError = code > 1000
|| (value != null && value.equals("Operation timed out"))
|| (code == -1 && key == null && value == null && !remote);
if (isError) {
latch.countDown();
}
});
Expand Down

0 comments on commit 1d87505

Please sign in to comment.