Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support 5 digit parks #106

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ archives:
format_overrides:
- goos: windows
format: zip
rlcp: true
files:
- README.md
- doc/whats_new.md
Expand Down Expand Up @@ -111,7 +110,7 @@ brews:
# same kind. We will probably unify this in the next major version like it is done with scoop.

# GitHub/GitLab repository to push the formula to
tap:
repository:
owner: on4kjm
name: homebrew-tap
# Optionally a branch can be provided. If the branch does not exist, it
Expand Down
4 changes: 2 additions & 2 deletions fleprocess/validate.go
jmMeessen marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func ValidateWwff(inputStr string) (ref, errorMsg string) {
return wrongInputStr, errorMsg
}

var validPotaRegexp = regexp.MustCompile(`^[\d]{0,1}[A-Z]{1,2}-[\d]{4}$`)
var validPotaRegexp = regexp.MustCompile(`^[\d]{0,1}[A-Z]{1,2}-[\d]{4,5}$`)

// ValidatePota verifies whether the supplied string is a valid POTA reference.
// The syntax is: AA-CCCC: AA = national prefix, CCCC = 4-digit numeric code (e.g. ON-0001).
// The syntax is: AA-CCCCC: AA = national prefix, CCCCC = 4 or 5-digit numeric code (e.g. ON-00001).
func ValidatePota(inputStr string) (ref, errorMsg string) {
inputStr = strings.ToUpper(strings.TrimSpace(inputStr))
wrongInputStr := "*" + inputStr
Expand Down
11 changes: 8 additions & 3 deletions fleprocess/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ func TestValidatePota(t *testing.T) {
args{inputStr: "4x-0258"},
"4X-0258", "",
},
{
"Good ref (5 digit park)",
args{inputStr: "k-10177"},
"K-10177", "",
},
{
"Bad ref (no country prefix)",
args{inputStr: "-0258"},
Expand All @@ -104,9 +109,9 @@ func TestValidatePota(t *testing.T) {
"*ON-258", "[ON-258] is an invalid POTA reference",
},
{
"Bad ref (no country prefix)",
args{inputStr: "on-02589"},
"*ON-02589", "[ON-02589] is an invalid POTA reference",
"Bad ref (park number too long)",
args{inputStr: "on-123456"},
"*ON-123456", "[ON-123456] is an invalid POTA reference",
},
}
for _, tt := range tests {
Expand Down
5 changes: 2 additions & 3 deletions test/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

* `./FLEcli -i test/data/fle-1.txt load`
* `./FLEcli -i test/data/sample_contest_ru.txt load`
* `go test ./...` runs the unit tests
* `go test ./...` runs the unit tests, from project root

* `./FLEcli -i test/data/[email protected] --interpolate adif --wwff --overwrite`
* `./FLEcli adif -i=test/data/[email protected] --interpolate --wwff --overwrite`


Install Bats: `brew install bats-core`
Install Bats: `brew install bats-core`
Loading