Fix Call & Grid parsing as well as WWFF Adif output bug

pull/55/head
Jean-Marc MEESSEN 4 years ago committed by GitHub
parent ca4a992b8e
commit b082b8aea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -68,6 +68,9 @@ func buildAdif(fullLog []LogLine, isWWFF bool, isSOTA bool) (adifList []string)
if isWWFF {
adifLine.WriteString(adifElement("MY_SIG", "WWFF"))
adifLine.WriteString(adifElement("MY_SIG_INFO", logLine.MyWWFF))
if logLine.WWFF != "" {
adifLine.WriteString(adifElement("SIG_INFO",logLine.WWFF))
}
}
if isSOTA {
adifLine.WriteString(adifElement("MY_SOTA_REF", logLine.MySOTA))

@ -190,13 +190,17 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
}
// Is it a call sign ?
//FIXME:
if validCallRegexp.MatchString(strings.ToUpper(element)) {
//If it starts with "#",it is a grid definition and not a call
if element[0] != '#' {
callErrorMsg := ""
logLine.Call, callErrorMsg = ValidateCall(element)
errorMsg = errorMsg + callErrorMsg
isRightOfCall = true
continue
}
}
// Is it a "full" time ?
if isRightOfCall == false {

@ -52,6 +52,12 @@ func TestParseLine(t *testing.T) {
args{inputStr: "15 g3noh", previousLine: LogLine{Time: "1200", Mode: "SSB"}},
LogLine{Time: "1215", ActualTime: "1215", Call: "G3NOH", Mode: "SSB", RSTsent: "59", RSTrcvd: "59"}, "",
},
//
{
"Parse suspecious line",
args{inputStr: "1029 Sm/dl8mf 559 579", previousLine: LogLine{Time: "1200", Mode: "CW", ModeType: "CW"}},
LogLine{Time: "1029", ActualTime: "1029", Call: "SM/DL8MF", Mode: "CW", ModeType: "CW", RSTsent: "559", RSTrcvd: "579"}, "",
},
{
"Parse partial time - 3",
args{inputStr: "4 g3noh", previousLine: LogLine{Time: "1200", Mode: "SSB"}},

@ -82,7 +82,7 @@ func ValidateGridLocator(grid string) (processedGrid, errorMsg string) {
return processedGrid, errorMsg
}
var validCallRegexp = regexp.MustCompile(`^[\d]{0,1}[A-Z]{1,2}\d([A-Z]{1,4}|\d{3,3}|\d{1,3}[A-Z])[A-Z]{0,5}`)
var validCallRegexp = regexp.MustCompile(`[\d]{0,1}[A-Z]{1,2}\d([A-Z]{1,4}|\d{3,3}|\d{1,3}[A-Z])[A-Z]{0,5}`)
var validPrefixRegexp = regexp.MustCompile(`\A[a-zA-Z0-9]{1,3}$`)
// ValidateCall verifies whether the supplied string is a valid callsign.

@ -182,6 +182,16 @@ func TestValidateCall(t *testing.T) {
args{sign: "DL/on4KJm/qrpp "},
"DL/ON4KJM/QRPP", "",
},
{
"Valid call from activation",
args{sign: "sm1/dl6jz/p"},
"SM1/DL6JZ/P", "",
},
{
"Valid call from activation (case 2)",
args{sign: "Sm/dl8mf"},
"SM/DL8MF", "",
},
{
"Valid prefix (issue #2)",
args{sign: "e7/z35m/p"},

Loading…
Cancel
Save