Skip to content

Commit

Permalink
understand when player incorrectly provides altitude in wrong order o…
Browse files Browse the repository at this point in the history
…f magnitude
  • Loading branch information
dharmab committed Jan 2, 2025
1 parent 6b5172b commit aa6da69
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ run:

.PHONY: test
test: generate
$(BUILD_VARS) $(GO) run gotest.tools/gotestsum -- $(BUILD_FLAGS) ./...
$(BUILD_VARS) $(GO) run gotest.tools/gotestsum -- $(BUILD_FLAGS) $(TEST_FLAGS) ./...

.PHONY: benchmark-whisper
benchmark-whisper: whisper
Expand Down
4 changes: 3 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ Wow, that was easy!
## Test
The canonical way to run the unit tests is by running `make test`. This can run tests for code that uses CGO. **This is the gate used for PR checks.**
The canonical way to run the unit tests is by running `make test`. This can run tests for code that uses CGO. **This is the gate used for PR checks.** You can pass additional flags to `go test` using TEST_FLAGS. For example, `TEST_FLAGS=-parallel=1 make test` will run the tests without parallelism (1 test worker), which can make the logs for a failed test easier to understand.
I have made an effort to structure packages so that CGO is never imported directly or indirectly within packages that aren't directly related to the Speech-To-Text and Text-To-Speech models. This means that most tests can be run though Visual Studio Code without the complexity and performance hit of CGO. **This is the easiest way to test and debug during development.**
## Benchmark
SkyEye's performance bottleneck is speech recognition. A small benchmark suite is provided which may be useful to test different speech recognition models or hardware acceleration. Run it with
Expand Down
14 changes: 13 additions & 1 deletion pkg/parser/declare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func TestParserDeclare(t *testing.T) {
},
},
{
text: "ANYFACE, DAGGER 1-1, DECLARE, BULZYE 01162, INJELS 18.",
text: "ANYFACE, DAGGER 1-1, DECLARE, BULZYE 01162",
expected: &brevity.DeclareRequest{
Callsign: "dagger 1 1",
Bullseye: *brevity.NewBullseye(
Expand All @@ -227,6 +227,18 @@ func TestParserDeclare(t *testing.T) {
Track: brevity.UnknownDirection,
},
},
{
text: "ANYFACE, DAGGER 1-1, DECLARE, BULZYE 011 62, INJELS 18.",
expected: &brevity.DeclareRequest{
Callsign: "dagger 1 1",
Bullseye: *brevity.NewBullseye(
bearings.NewMagneticBearing(11*unit.Degree),
62*unit.NauticalMile,
),
Altitude: 18000 * unit.Foot,
Track: brevity.UnknownDirection,
},
},
{
text: "anyface, 140, declare BULLSEYE 058146",
expected: &brevity.DeclareRequest{
Expand Down
8 changes: 7 additions & 1 deletion pkg/parser/spatial.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,13 @@ func parseAltitude(scanner *bufio.Scanner) (unit.Length, bool) {
if !ok {
return 0, false
}
return unit.Length(d) * unit.Foot, true

altitude := unit.Length(d) * unit.Foot
// Values below 100 are likely a player incorrectly saying "angels XX" intead of thousands of feet.
if d < 100 {
altitude = altitude * 1000
}
return altitude, true
}

func parseTrack(scanner *bufio.Scanner) brevity.Track {
Expand Down

0 comments on commit aa6da69

Please sign in to comment.