From ec6cb27812c32d4caa450b403f13f5dc61f7469e Mon Sep 17 00:00:00 2001 From: Jean-Marc MEESSEN Date: Mon, 8 Jun 2020 22:41:28 +0200 Subject: [PATCH] Some Cleaning --- cmd/wwff_test.go | 28 ++++++++++++++++++++++++---- test/commands.md | 3 ++- test/data/fle-1.txt | 1 + 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/cmd/wwff_test.go b/cmd/wwff_test.go index 8055a0f..d592361 100644 --- a/cmd/wwff_test.go +++ b/cmd/wwff_test.go @@ -13,21 +13,41 @@ func TestValidateWwff(t *testing.T) { wantErrorMsg string }{ { - "Good call (simple)", + "Good ref (simple)", args{ inputStr: "onff-0258", }, "ONFF-0258", "", }, { - "Good call (simple)", + "Good ref (single digit country)", args{ inputStr: "fff-0258", }, "FFF-0258", "", }, { - "Good call (simple)", + "Good ref (Numerical country)", args{ inputStr: "4xff-0258", }, "4XFF-0258", "", }, - //TODO: add the invalid cases + { + "Bad ref (no country prefix)", + args{ inputStr: "ff-0258", }, + "*FF-0258", "Invalid WWFF reference", + }, + { + "Bad ref (wrong separator)", + args{ inputStr: "gff/0258", }, + "*GFF/0258", "Invalid WWFF reference", + }, + { + "Bad ref (reference too short)", + args{ inputStr: "onff-258", }, + "*ONFF-258", "Invalid WWFF reference", + }, + { + "Bad ref (no country prefix)", + args{ inputStr: "onff-02589", }, + "*ONFF-02589", "Invalid WWFF reference", + }, + } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/test/commands.md b/test/commands.md index 9c17505..faaf154 100644 --- a/test/commands.md +++ b/test/commands.md @@ -1,4 +1,5 @@ # Commands for testing * `./FLEcli -i test/data/fle-1.txt load` -* `./FLEcli -i test/sample_contest_ru.txt load` \ No newline at end of file +* `./FLEcli -i test/sample_contest_ru.txt load` +* `go test ./...` runs the unit tests \ No newline at end of file diff --git a/test/data/fle-1.txt b/test/data/fle-1.txt index 0947a44..8f7cd03 100644 --- a/test/data/fle-1.txt +++ b/test/data/fle-1.txt @@ -2,6 +2,7 @@ mycall on4kjm/p operator on4kjm nickname Portable +QslMsg This is a QSL message # Log date 2020-05-23