support 5 digit parks (#106)

* support 5 digit parks
* update releaser file
* update comment to match code revision
pull/102/head
Bryan Nehl 10 months ago committed by GitHub
parent 9f0664d0ca
commit 9cdef88796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -63,7 +63,6 @@ archives:
format_overrides: format_overrides:
- goos: windows - goos: windows
format: zip format: zip
rlcp: true
files: files:
- README.md - README.md
- doc/whats_new.md - doc/whats_new.md
@ -111,7 +110,7 @@ brews:
# same kind. We will probably unify this in the next major version like it is done with scoop. # 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 # GitHub/GitLab repository to push the formula to
tap: repository:
owner: on4kjm owner: on4kjm
name: homebrew-tap name: homebrew-tap
# Optionally a branch can be provided. If the branch does not exist, it # Optionally a branch can be provided. If the branch does not exist, it

@ -51,10 +51,10 @@ func ValidateWwff(inputStr string) (ref, errorMsg string) {
return wrongInputStr, errorMsg 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. // 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) { func ValidatePota(inputStr string) (ref, errorMsg string) {
inputStr = strings.ToUpper(strings.TrimSpace(inputStr)) inputStr = strings.ToUpper(strings.TrimSpace(inputStr))
wrongInputStr := "*" + inputStr wrongInputStr := "*" + inputStr

@ -88,6 +88,11 @@ func TestValidatePota(t *testing.T) {
args{inputStr: "4x-0258"}, args{inputStr: "4x-0258"},
"4X-0258", "", "4X-0258", "",
}, },
{
"Good ref (5 digit park)",
args{inputStr: "k-10177"},
"K-10177", "",
},
{ {
"Bad ref (no country prefix)", "Bad ref (no country prefix)",
args{inputStr: "-0258"}, args{inputStr: "-0258"},
@ -104,9 +109,9 @@ func TestValidatePota(t *testing.T) {
"*ON-258", "[ON-258] is an invalid POTA reference", "*ON-258", "[ON-258] is an invalid POTA reference",
}, },
{ {
"Bad ref (no country prefix)", "Bad ref (park number too long)",
args{inputStr: "on-02589"}, args{inputStr: "on-123456"},
"*ON-02589", "[ON-02589] is an invalid POTA reference", "*ON-123456", "[ON-123456] is an invalid POTA reference",
}, },
} }
for _, tt := range tests { for _, tt := range tests {

@ -2,10 +2,9 @@
* `./FLEcli -i test/data/fle-1.txt load` * `./FLEcli -i test/data/fle-1.txt load`
* `./FLEcli -i test/data/sample_contest_ru.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/ON4KJM@ONFF-025920200524.txt --interpolate adif --wwff --overwrite` * `./FLEcli -i test/data/ON4KJM@ONFF-025920200524.txt --interpolate adif --wwff --overwrite`
* `./FLEcli adif -i=test/data/ON4KJM@ONFF-025920200524.txt --interpolate --wwff --overwrite` * `./FLEcli adif -i=test/data/ON4KJM@ONFF-025920200524.txt --interpolate --wwff --overwrite`
Install Bats: `brew install bats-core` Install Bats: `brew install bats-core`
Loading…
Cancel
Save