-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backfill parser tests with FPL data from 2024-12-14 through 2024-12-20
- Loading branch information
Showing
10 changed files
with
268 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package parser | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/dharmab/skyeye/pkg/brevity" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParserAlphaCheck(t *testing.T) { | ||
t.Parallel() | ||
testCases := []parserTestCase{ | ||
{ | ||
text: "ANYFACE, HORNET 1, CHECKING IN AS FRAGGED, REQUEST ALPHA CHECK DEPOT", | ||
expected: &brevity.AlphaCheckRequest{ | ||
Callsign: "hornet 1", | ||
}, | ||
}, | ||
{ | ||
text: "anyface intruder 11 alpha check", | ||
expected: &brevity.AlphaCheckRequest{ | ||
Callsign: "intruder 1 1", | ||
}, | ||
}, | ||
{ | ||
text: "anyface intruder 11, checking in as fragged, request alpha check bullseye", | ||
expected: &brevity.AlphaCheckRequest{ | ||
Callsign: "intruder 1 1", | ||
}, | ||
}, | ||
{ | ||
text: TestCallsign + "intruder 11 alpha check", | ||
expected: &brevity.AlphaCheckRequest{ | ||
Callsign: "intruder 1 1", | ||
}, | ||
}, | ||
{ | ||
text: TestCallsign + "Gunfighter 2-1, AlphaJack, Bullseye.", | ||
expected: &brevity.AlphaCheckRequest{ | ||
Callsign: "gunfighter 2 1", | ||
}, | ||
}, | ||
{ | ||
text: TestCallsign + " HORNET 12, ALPHACHEK", | ||
expected: &brevity.AlphaCheckRequest{ | ||
Callsign: "hornet 1 2", | ||
}, | ||
}, | ||
} | ||
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) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package parser | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/dharmab/skyeye/pkg/brevity" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParserCheckIn(t *testing.T) { | ||
t.Parallel() | ||
testCases := []parserTestCase{ | ||
{ | ||
text: "anyface Baron91 checking in.", | ||
expected: &brevity.CheckInRequest{ | ||
Callsign: "baron 9 1", | ||
}, | ||
}, | ||
{ | ||
text: "anyface, Mako, 1-1, check in.", | ||
expected: &brevity.CheckInRequest{ | ||
Callsign: "mako 1 1", | ||
}, | ||
}, | ||
} | ||
|
||
runParserTestCases(t, New(TestCallsign, true), testCases, func(t *testing.T, test parserTestCase, request any) { | ||
t.Helper() | ||
expected := test.expected.(*brevity.CheckInRequest) | ||
actual := request.(*brevity.CheckInRequest) | ||
require.Equal(t, expected.Callsign, actual.Callsign) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters