Skip to content

Commit

Permalink
Synchronise with local work
Browse files Browse the repository at this point in the history
  • Loading branch information
jmMeessen committed Jul 20, 2020
2 parents 815622e + 7cc6078 commit 46fdefa
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
9 changes: 8 additions & 1 deletion cmd/parse_line.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var regexpIsOMname = regexp.MustCompile("^@")
var regexpIsGridLoc = regexp.MustCompile("^#")
var regexpIsRst = regexp.MustCompile("^[\\d]{1,3}$")
var regexpIsFreq = regexp.MustCompile("^[\\d]+\\.[\\d]+$")
var regexpIsSotaKeyWord = regexp.MustCompile("(?i)^sota")

// ParseLine cuts a FLE line into useful bits
func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg string) {
Expand Down Expand Up @@ -232,7 +233,13 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
continue
}

// Is it a WWFF to WWFF reference?
// If the "sota" keyword is used, skip it
if regexpIsSotaKeyWord.MatchString(element) {
// this keyword is not supported anymore with FLE 3 and doesn't add any value
continue
}

// Is it a Summit to Summit (sota) reference?
workRef, sotaErr := ValidateSota(element)
if sotaErr == "" {
logLine.SOTA = workRef
Expand Down
5 changes: 5 additions & 0 deletions cmd/parse_line_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ func TestParseLine(t *testing.T) {
args{inputStr: "1230 on4kjm 5 599", previousLine: LogLine{Mode: "FM", ModeType: "PHONE"}},
LogLine{Call: "ON4KJM", Time: "1230", ActualTime: "1230", RSTsent: "55", RSTrcvd: "*599", Mode: "FM", ModeType: "PHONE"}, "Invalid report (599) for PHONE mode ",
},
{
"SOTA keywork ",
args{inputStr: "1230 oe6cud/p sota oe/st-309", previousLine: LogLine{Mode: "FM", ModeType: "PHONE"}},
LogLine{Call: "OE6CUD/P", Time: "1230", ActualTime: "1230", RSTsent: "59", RSTrcvd: "59", Mode: "FM", ModeType: "PHONE", SOTA: "OE/ST-309"}, "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func ValidateWwff(inputStr string) (ref, errorMsg string) {
}

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\d?[a-zA-Z]{1,2}$`)
var validPrefixRegexp = regexp.MustCompile(`\A[a-zA-Z0-9]{1,3}$`)

// ValidateCall verifies whether the supplied string is a valid callsign.
// prefix and suffix are not checked for validity
Expand Down
16 changes: 13 additions & 3 deletions cmd/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,17 @@ func TestValidateCall(t *testing.T) {
args{sign: "DL/on4KJm/qrpp "},
"DL/ON4KJM/QRPP", "",
},
//Error cases
{
"Valid prefix (issue #2)",
args{sign: "e7/z35m/p"},
"E7/Z35M/P", "",
},
{
"Valid E7 callsign (issue #2)",
args{sign: "e7xyz"},
"E7XYZ", "",
},
//*** Error cases *****
{
"Pure junk passed",
args{sign: "aaaaaa"},
Expand All @@ -200,8 +210,8 @@ func TestValidateCall(t *testing.T) {
},
{
"invalid prefix",
args{sign: "xyz/on4kjm"},
"*XYZ/ON4KJM", "Invalid prefix",
args{sign: "xyz4/on4kjm"},
"*XYZ4/ON4KJM", "Invalid prefix",
},
{
"Too many /",
Expand Down
60 changes: 60 additions & 0 deletions test/data/fle-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
date 2020-07-19
mycall ON6ZQ/P
mysota ON/ON-018

# No 1

# Spotlite
# ON6ZQ/P ON ON-018 7.032 cw

# parking:
# Rue du Broux
# 6940 Durbuy
# 50.326490, 5.532476

cw
30m
1150

55 ix1ihr
f8dgf
56 ea2dt
57 oe6cud/p sota oe/st-309
yo6cfb
1200 e7/z35m/p
dl2hwi
04 oe7phi
04 dl8dxl
05 ok1dpu
ei5hj
iw0hk
g3rtu
07 ok2uz
08 ct1drb
ok2k
11 dd6do
12 oz6abz
13 ea2if/p sota ea2/nv-189
dl5dxs/p oo25
15 dl7uxg

40m
25 dl1fu
26 hb9agh
30 oe8spw
yl3cw
hb9bhu/p sota hb/bl-005
dl7vkd
31 hb9cbr/p sota hb/NE-007
hb9afi/p sota hb/VS-239
m0tcl/p
f6dra
35 g0aol

# Parsing error at line 22: Unable to parse sota
# Parsing error at line 24: Invalid prefix
# Parsing error at line 37: Unable to parse sota
# Parsing error at line 38: Unable to parse oo25
# Parsing error at line 46: Unable to parse sota
# Parsing error at line 48: Unable to parse sota
# Parsing error at line 49: Unable to parse sota

0 comments on commit 46fdefa

Please sign in to comment.