mirror of
https://github.com/on4kjm/FLEcli.git
synced 2025-01-18 21:01:10 +01:00
Merge branch 'master' into 101-support-multiple-sota-in-same-input-file
This commit is contained in:
commit
02e107bf98
7 changed files with 29 additions and 17 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -46,7 +46,7 @@ jobs:
|
|||
make test-coverage
|
||||
|
||||
- name: Upload Coverage report to CodeCov
|
||||
uses: codecov/codecov-action@v4.0.1
|
||||
uses: codecov/codecov-action@v4.1.0
|
||||
with:
|
||||
token: ${{secrets.CODECOV_TOKEN}}
|
||||
file: ./coverage.txt
|
||||
|
|
|
@ -93,6 +93,9 @@ func buildAdif(fullLog []LogLine, adifParams AdifParams) (adifList []string) {
|
|||
if logLine.MyGrid != "" {
|
||||
adifLine.WriteString(adifElement("MY_GRIDSQUARE", logLine.MyGrid))
|
||||
}
|
||||
if logLine.MyCounty != "" {
|
||||
adifLine.WriteString(adifElement("MY_CNTY", logLine.MyCounty))
|
||||
}
|
||||
if logLine.Nickname != "" {
|
||||
adifLine.WriteString(adifElement("APP_EQSL_QTH_NICKNAME", logLine.Nickname))
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ func Test_buildAdif(t *testing.T) {
|
|||
|
||||
sampleFilledLogPOTA := []LogLine{
|
||||
{MyCall: "ON4KJM/P", Call: "S57LC", Date: "2020-05-24", Time: "1310", Band: "20m", Frequency: "14.045", Mode: "CW", RSTsent: "599", RSTrcvd: "599", MyPOTA: "ON-00259", Operator: "ON4KJM", Nickname: "ON-00259-1"},
|
||||
{MyCall: "ON4KJM/P", Call: "ON4LY", Date: "2020-05-24", Time: "1312", Band: "20m", Mode: "CW", RSTsent: "559", RSTrcvd: "599", MyPOTA: "ON-00259", Operator: "ON4KJM"},
|
||||
{MyCall: "ON4KJM/P", Call: "ON4LY", Date: "2020-05-24", Time: "1312", Band: "20m", Mode: "CW", RSTsent: "559", RSTrcvd: "599", MyPOTA: "ON-00259", Operator: "ON4KJM", MyCounty: "Ham County"},
|
||||
}
|
||||
|
||||
expectedOutputPOTA := []string{
|
||||
|
@ -105,7 +105,7 @@ func Test_buildAdif(t *testing.T) {
|
|||
"<ADIF_VER:5>3.1.0",
|
||||
"<EOH>",
|
||||
"<STATION_CALLSIGN:8>ON4KJM/P <CALL:5>S57LC <QSO_DATE:8>20200524 <TIME_ON:4>1310 <BAND:3>20m <MODE:2>CW <FREQ:6>14.045 <RST_SENT:3>599 <RST_RCVD:3>599 <MY_SIG:4>POTA <MY_SIG_INFO:8>ON-00259 <OPERATOR:6>ON4KJM <APP_EQSL_QTH_NICKNAME:10>ON-00259-1 <EOR>",
|
||||
"<STATION_CALLSIGN:8>ON4KJM/P <CALL:5>ON4LY <QSO_DATE:8>20200524 <TIME_ON:4>1312 <BAND:3>20m <MODE:2>CW <RST_SENT:3>559 <RST_RCVD:3>599 <MY_SIG:4>POTA <MY_SIG_INFO:8>ON-00259 <OPERATOR:6>ON4KJM <EOR>",
|
||||
"<STATION_CALLSIGN:8>ON4KJM/P <CALL:5>ON4LY <QSO_DATE:8>20200524 <TIME_ON:4>1312 <BAND:3>20m <MODE:2>CW <RST_SENT:3>559 <RST_RCVD:3>599 <MY_SIG:4>POTA <MY_SIG_INFO:8>ON-00259 <OPERATOR:6>ON4KJM <MY_CNTY:10>Ham County <EOR>",
|
||||
}
|
||||
|
||||
sampleFilledLogPOTA2 := []LogLine{
|
||||
|
|
|
@ -79,6 +79,10 @@ func SprintHeaderValues(logLine LogLine) string {
|
|||
output.WriteString("MyGrid " + logLine.MyGrid + "\n")
|
||||
}
|
||||
|
||||
if logLine.MyCounty != "" {
|
||||
output.WriteString("MyCounty " + logLine.MyCounty + "\n")
|
||||
}
|
||||
|
||||
return output.String()
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
|
|||
isInferTimeFatalError := false
|
||||
|
||||
regexpLineComment := regexp.MustCompile(`^[[:blank:]]*#`)
|
||||
regexpInLineComment := regexp.MustCompile(`.*#.*`)
|
||||
regexpOnlySpaces := regexp.MustCompile(`^\s+$`)
|
||||
regexpSingleMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{.+}$`)
|
||||
regexpStartMultiLineComment := regexp.MustCompile(`^[[:blank:]]*{`)
|
||||
|
@ -65,6 +64,7 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
|
|||
regexpHeaderMySota := regexp.MustCompile(`(?i)^mysota\s+`)
|
||||
regexpHeaderMyPota := regexp.MustCompile(`(?i)^mypota\s+`)
|
||||
regexpHeaderMyGrid := regexp.MustCompile(`(?i)^mygrid\s+`)
|
||||
regexpHeaderMyCounty := regexp.MustCompile(`(?i)^mycounty\s+`)
|
||||
regexpHeaderQslMsg := regexp.MustCompile(`(?i)^qslmsg\s+`)
|
||||
regexpHeaderNickname := regexp.MustCompile(`(?i)^nickname\s+`)
|
||||
|
||||
|
@ -74,6 +74,7 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
|
|||
headerMySOTA := ""
|
||||
headerMyPOTA := ""
|
||||
headerMyGrid := ""
|
||||
headerMyCounty := ""
|
||||
headerQslMsg := ""
|
||||
headerNickname := ""
|
||||
headerIsFirstLine := true
|
||||
|
@ -106,10 +107,6 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
|
|||
if (len(eachline) == 0) || (regexpOnlySpaces.MatchString(eachline)) {
|
||||
continue
|
||||
}
|
||||
// a comment starts somewhere on the line, remove the comment
|
||||
if regexpInLineComment.MatchString(eachline) {
|
||||
eachline = strings.Split(eachline, "#")[0]
|
||||
}
|
||||
|
||||
// Process multi-line comments
|
||||
if regexpStartMultiLineComment.MatchString(eachline) {
|
||||
|
@ -252,6 +249,16 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
|
|||
continue
|
||||
}
|
||||
|
||||
//My County
|
||||
if regexpHeaderMyCounty.MatchString(eachline) {
|
||||
myMyCountyList := regexpHeaderMyCounty.Split(eachline, -1)
|
||||
if len(myMyCountyList[1]) > 0 {
|
||||
headerMyCounty = myMyCountyList[1]
|
||||
}
|
||||
//If there is no data after the marker, we just skip the data.
|
||||
continue
|
||||
}
|
||||
|
||||
//QSL Message
|
||||
if regexpHeaderQslMsg.MatchString(eachline) {
|
||||
myQslMsgList := regexpHeaderQslMsg.Split(eachline, -1)
|
||||
|
@ -291,6 +298,7 @@ func LoadFile(inputFilename string, isInterpolateTime bool) (filleFullLog []LogL
|
|||
previousLogLine.MyPOTA = headerMyPOTA
|
||||
previousLogLine.MySOTA = headerMySOTA
|
||||
previousLogLine.MyGrid = headerMyGrid
|
||||
previousLogLine.MyCounty = headerMyCounty
|
||||
previousLogLine.QSLmsg = headerQslMsg //previousLogLine.QslMsg is redundant
|
||||
previousLogLine.Nickname = headerNickname
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ func TestLoadFile_happyCase(t *testing.T) {
|
|||
dataArray = append(dataArray, "mySota on/on-001")
|
||||
dataArray = append(dataArray, "myPota k-0802")
|
||||
dataArray = append(dataArray, "myGrid jo50")
|
||||
dataArray = append(dataArray, "myCounty Ham County")
|
||||
dataArray = append(dataArray, "QslMsg This is a QSL message")
|
||||
dataArray = append(dataArray, " ")
|
||||
dataArray = append(dataArray, " #Log")
|
||||
|
@ -49,7 +50,6 @@ func TestLoadFile_happyCase(t *testing.T) {
|
|||
dataArray = append(dataArray, "40m cw 0950 ik5zve/5 9 5")
|
||||
dataArray = append(dataArray, "on6zq")
|
||||
dataArray = append(dataArray, "0954 on4do")
|
||||
dataArray = append(dataArray, "0955 k0emt # on line comment")
|
||||
|
||||
temporaryDataFileName := createTestFile(dataArray)
|
||||
|
||||
|
@ -88,6 +88,10 @@ func TestLoadFile_happyCase(t *testing.T) {
|
|||
if loadedLogFile[0].QSLmsg != expectedValue {
|
||||
t.Errorf("Not the expected QSL Message from Header value: %s (expecting %s)", loadedLogFile[0].QSLmsg, expectedValue)
|
||||
}
|
||||
expectedValue = "Ham County"
|
||||
if loadedLogFile[0].MyCounty != expectedValue {
|
||||
t.Errorf("Not the expected MyCounty from Header value: %s (expecting %s)", loadedLogFile[0].MyCounty, expectedValue)
|
||||
}
|
||||
expectedValue = "IK5ZVE/5"
|
||||
if loadedLogFile[0].Call != expectedValue {
|
||||
t.Errorf("Not the expected Call[0] value: %s (expecting %s)", loadedLogFile[0].Call, expectedValue)
|
||||
|
@ -116,14 +120,6 @@ func TestLoadFile_happyCase(t *testing.T) {
|
|||
if loadedLogFile[2].Time != expectedValue {
|
||||
t.Errorf("Not the expected Time[2] value: %s (expecting %s)", loadedLogFile[2].Time, expectedValue)
|
||||
}
|
||||
expectedValue = "K0EMT"
|
||||
if loadedLogFile[3].Call != expectedValue {
|
||||
t.Errorf("Not the expected Call[3] value: %s (expecting %s)", loadedLogFile[3].Call, expectedValue)
|
||||
}
|
||||
expectedValue = "0955"
|
||||
if loadedLogFile[3].Time != expectedValue {
|
||||
t.Errorf("Not the expected Time[3] value: %s (expecting %s)", loadedLogFile[3].Time, expectedValue)
|
||||
}
|
||||
//Clean Up
|
||||
os.Remove(temporaryDataFileName)
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ type LogLine struct {
|
|||
MyPota string
|
||||
MySota string
|
||||
MyGrid string
|
||||
MyCounty string
|
||||
QslMsgFromHeader string
|
||||
Nickname string
|
||||
Mode string
|
||||
|
|
Loading…
Reference in a new issue