Skip to content

Commit

Permalink
Backfill parser tests with FPL data from 2024-12-20 onwards
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmab committed Jan 2, 2025
1 parent aa6da69 commit 7fd725c
Show file tree
Hide file tree
Showing 7 changed files with 312 additions and 76 deletions.
26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Created by https://www.toptal.com/developers/gitignore/api/go,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=go,windows
# Created by https://www.toptal.com/developers/gitignore/api/go,windows,vim
# Edit at https://www.toptal.com/developers/gitignore?templates=go,windows,vim

### Go ###
# If you prefer the allow list template instead of the deny list, see community template:
Expand All @@ -24,6 +24,28 @@
# Go workspace file
go.work


### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Expand Down
150 changes: 150 additions & 0 deletions pkg/parser/bogeydope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,156 @@ func TestParserBogeyDope(t *testing.T) {
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", Gunfighter 2-1, request 'BOGIDOPE",
expected: &brevity.BogeyDopeRequest{
Callsign: "gunfighter 2 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", REVA 1-3, POGGY DOPE.",
expected: &brevity.BogeyDopeRequest{
Callsign: "reva 1 3",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", MAKO, POGY",
expected: &brevity.BogeyDopeRequest{
Callsign: "mako",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", MAKO 1-1, request POGGY DOPE",
expected: &brevity.BogeyDopeRequest{
Callsign: "mako 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " Viper11 BuggyDoke.",
expected: &brevity.BogeyDopeRequest{
Callsign: "viper 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", HORNET, 1, 2, BOGGID, 2.",
expected: &brevity.BogeyDopeRequest{
Callsign: "hornet 1 2",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " ugly one-one, POKIDO.",
expected: &brevity.BogeyDopeRequest{
Callsign: "ugly 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + "ugly one-one, buggy two.",
expected: &brevity.BogeyDopeRequest{
Callsign: "ugly 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", Viking31, request POGIDOP.",
expected: &brevity.BogeyDopeRequest{
Callsign: "viking 3 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", Waking Free 1, request to log it up.",
expected: &brevity.BogeyDopeRequest{
Callsign: "waking 3 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " HUD 13, PUGGY DOPE.",
expected: &brevity.BogeyDopeRequest{
Callsign: "hud 1 3",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " Mage 1-2, Bugga Dope.",
expected: &brevity.BogeyDopeRequest{
Callsign: "mage 1 2",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " serpent, 6/8, BUBBYDO.",
expected: &brevity.BogeyDopeRequest{
Callsign: "serpent 6 8",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " REBEL 1-1, POGADO.",
expected: &brevity.BogeyDopeRequest{
Callsign: "rebel 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " REBEL 1-1, POGY-DO.",
expected: &brevity.BogeyDopeRequest{
Callsign: "rebel 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + " REBEL 1-1, POGIDO.",
expected: &brevity.BogeyDopeRequest{
Callsign: "rebel 1 1",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", Glimmer, Buggetto.",
expected: &brevity.BogeyDopeRequest{
Callsign: "glimmer",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", Hood, 1-3, BOWIDO.",
expected: &brevity.BogeyDopeRequest{
Callsign: "hood 1 3",
Filter: brevity.Aircraft,
},
},
{
text: "\"" + TestCallsign + " \"HOOD 1-3 BOBBY DOKE\"",
expected: &brevity.BogeyDopeRequest{
Callsign: "hood 1 3",
Filter: brevity.Aircraft,
},
},
{
text: TestCallsign + ", serpent, 6/8, BOBY DOPE.",
expected: &brevity.BogeyDopeRequest{
Callsign: "serpent 6 8",
Filter: brevity.Aircraft,
},
},
{
// Yes, this is a real transcription from the wild!
// Whisper was trained on YouTube videos and it seems to have
// picked up this rapper's name...
text: TestCallsign + ", serpent, 6ix9ine, Bogeydough.",
expected: &brevity.BogeyDopeRequest{
Callsign: "serpent 6 9",
Filter: brevity.Aircraft,
},
},
}
runParserTestCases(t, New(TestCallsign, true), testCases, func(t *testing.T, test parserTestCase, request any) {
t.Helper()
Expand Down
10 changes: 10 additions & 0 deletions pkg/parser/declare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ func TestParserDeclare(t *testing.T) {
Track: brevity.UnknownDirection,
},
},
{
text: TestCallsign + " GOLOM11, DECLARE, BRAA 25040.",
expected: &brevity.DeclareRequest{
Callsign: "golom 1 1",
Bearing: bearings.NewMagneticBearing(250 * unit.Degree),
Range: 40 * unit.NauticalMile,
Track: brevity.UnknownDirection,
IsBRAA: true,
},
},
}
runParserTestCases(t, New(TestCallsign, true), testCases, func(t *testing.T, test parserTestCase, request any) {
t.Helper()
Expand Down
64 changes: 5 additions & 59 deletions pkg/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,71 +79,17 @@ func TestParserAlphaCheck(t *testing.T) {
Callsign: "intruder 1 1",
},
},
}
runParserTestCases(t, New(TestCallsign, true), testCases, func(t *testing.T, test parserTestCase, request any) {
t.Helper()
expected := test.expected.(*brevity.AlphaCheckRequest)
actual := request.(*brevity.AlphaCheckRequest)
require.Equal(t, expected.Callsign, actual.Callsign)
})
}

func TestParserRadioCheck(t *testing.T) {
t.Parallel()
testCases := []parserTestCase{
{
text: "anyface Wildcat11 radio check out.",
expected: &brevity.RadioCheckRequest{
Callsign: "wildcat 1 1",
},
},
{
text: "Any face, Wildcat11, radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "wildcat 1 1",
},
},
{
text: "anyface intruder 11 radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder 1-1 radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder five one radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 5 1",
},
},
{
text: "anyface intruder 11 request radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder 11 radio check 133 point zero",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder 11 radio check on button five",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
text: TestCallsign + "Gunfighter 2-1, AlphaJack, Bullseye.",
expected: &brevity.AlphaCheckRequest{
Callsign: "gunfighter 2 1",
},
},
}
runParserTestCases(t, New(TestCallsign, true), testCases, func(t *testing.T, test parserTestCase, request any) {
t.Helper()
expected := test.expected.(*brevity.RadioCheckRequest)
actual := request.(*brevity.RadioCheckRequest)
expected := test.expected.(*brevity.AlphaCheckRequest)
actual := request.(*brevity.AlphaCheckRequest)
require.Equal(t, expected.Callsign, actual.Callsign)
})
}
Expand Down
80 changes: 80 additions & 0 deletions pkg/parser/radiocheck_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package parser

import (
"testing"

"github.com/dharmab/skyeye/pkg/brevity"
"github.com/stretchr/testify/require"
)

func TestParserRadioCheck(t *testing.T) {
t.Parallel()
testCases := []parserTestCase{
{
text: "anyface Wildcat11 radio check out.",
expected: &brevity.RadioCheckRequest{
Callsign: "wildcat 1 1",
},
},
{
text: "Any face, Wildcat11, radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "wildcat 1 1",
},
},
{
text: "anyface intruder 11 radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder 1-1 radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder five one radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 5 1",
},
},
{
text: "anyface intruder 11 request radio check",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder 11 radio check 133 point zero",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: "anyface intruder 11 radio check on button five",
expected: &brevity.RadioCheckRequest{
Callsign: "intruder 1 1",
},
},
{
text: TestCallsign + ", this is Heaven11. Request Mic Check.",
expected: &brevity.RadioCheckRequest{
Callsign: "heaven 1 1",
},
},
{
text: TestCallsign + ", this is heaven. Request mic check",
expected: &brevity.RadioCheckRequest{
Callsign: "heaven",
},
},
}
runParserTestCases(t, New(TestCallsign, true), testCases, func(t *testing.T, test parserTestCase, request any) {
t.Helper()
expected := test.expected.(*brevity.RadioCheckRequest)
actual := request.(*brevity.RadioCheckRequest)
require.Equal(t, expected.Callsign, actual.Callsign)
})
}
Loading

0 comments on commit 7fd725c

Please sign in to comment.