-
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-20 onwards
- Loading branch information
Showing
7 changed files
with
312 additions
and
76 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
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,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) | ||
}) | ||
} |
Oops, something went wrong.