Proper processing of the WWFF keyword

pull/47/head
Jean-Marc MEESSEN 4 years ago committed by GitHub
parent 3a76290ac4
commit 494fbaa987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,12 +1,17 @@
# What's new? # What's new?
## v0.1.1 ## v0.1.2
* Correctly process of optional WWFF keyword(issue #38)
* Correct some typos
## Previous releases
### v0.1.1
* Improved test coverage * Improved test coverage
* Improved build automation * Improved build automation
* Improved release notes publication * Improved release notes publication
## Previous releases
### v0.1.0 ### v0.1.0
* First public MVP (Minimal Viable Product relase). Supports only SOTA and WWFF type log files. Some header keywords are missing as well as date increments. * First public MVP (Minimal Viable Product relase). Supports only SOTA and WWFF type log files. Some header keywords are missing as well as date increments.

@ -137,7 +137,6 @@ func TestProcessAdifCommand(t *testing.T) {
args{inputFilename: "../test/data/fle-4-no-qso.txt", outputFilename: "", isInterpolateTime: false, isOverwrite: false}, args{inputFilename: "../test/data/fle-4-no-qso.txt", outputFilename: "", isInterpolateTime: false, isOverwrite: false},
true, true,
}, },
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {

@ -61,6 +61,7 @@ var regexpIsGridLoc = regexp.MustCompile("^#")
var regexpIsRst = regexp.MustCompile("^[\\d]{1,3}$") var regexpIsRst = regexp.MustCompile("^[\\d]{1,3}$")
var regexpIsFreq = regexp.MustCompile("^[\\d]+\\.[\\d]+$") var regexpIsFreq = regexp.MustCompile("^[\\d]+\\.[\\d]+$")
var regexpIsSotaKeyWord = regexp.MustCompile("(?i)^sota") var regexpIsSotaKeyWord = regexp.MustCompile("(?i)^sota")
var regexpIsWwffKeyWord = regexp.MustCompile("(?i)^wwff")
// ParseLine cuts a FLE line into useful bits // ParseLine cuts a FLE line into useful bits
func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg string) { func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg string) {
@ -226,7 +227,13 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
continue continue
} }
// Is it a WWFF to WWFF reference? // If the "wwff" keyword is used, skip it
if regexpIsWwffKeyWord.MatchString(element) {
// this keyword is not requiered anymore with FLE 3 and doesn't add any value
continue
}
// Is it a "WWFF to WWFF" reference?
workRef, wwffErr := ValidateWwff(element) workRef, wwffErr := ValidateWwff(element)
if wwffErr == "" { if wwffErr == "" {
logLine.WWFF = workRef logLine.WWFF = workRef
@ -235,7 +242,7 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg
// If the "sota" keyword is used, skip it // If the "sota" keyword is used, skip it
if regexpIsSotaKeyWord.MatchString(element) { if regexpIsSotaKeyWord.MatchString(element) {
// this keyword is not supported anymore with FLE 3 and doesn't add any value // this keyword is not requiered anymore with FLE 3 and doesn't add any value
continue continue
} }

@ -132,6 +132,21 @@ func TestParseLine(t *testing.T) {
args{inputStr: "1230 oe6cud/p sota oe/st-309", previousLine: LogLine{Mode: "FM", ModeType: "PHONE"}}, 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"}, "", LogLine{Call: "OE6CUD/P", Time: "1230", ActualTime: "1230", RSTsent: "59", RSTrcvd: "59", Mode: "FM", ModeType: "PHONE", SOTA: "OE/ST-309"}, "",
}, },
{
"implied SOTA keywork ",
args{inputStr: "1230 oe6cud/p 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"}, "",
},
{
"WWFF keywork ",
args{inputStr: "1230 oe6cud/p wwff onff-0258", previousLine: LogLine{Mode: "FM", ModeType: "PHONE"}},
LogLine{Call: "OE6CUD/P", Time: "1230", ActualTime: "1230", RSTsent: "59", RSTrcvd: "59", Mode: "FM", ModeType: "PHONE", WWFF: "ONFF-0258"}, "",
},
{
"implied WWFF keywork ",
args{inputStr: "1230 oe6cud/p onff-0258", previousLine: LogLine{Mode: "FM", ModeType: "PHONE"}},
LogLine{Call: "OE6CUD/P", Time: "1230", ActualTime: "1230", RSTsent: "59", RSTrcvd: "59", Mode: "FM", ModeType: "PHONE", WWFF: "ONFF-0258"}, "",
},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {

Loading…
Cancel
Save