-
Notifications
You must be signed in to change notification settings - Fork 1
/
veron_test.go
51 lines (45 loc) · 986 Bytes
/
veron_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package conval
import (
"testing"
"github.com/ftl/hamradio/callsign"
"github.com/stretchr/testify/assert"
)
func TestVeronEntity(t *testing.T) {
tt := []struct {
call string
dxccEntity DXCCEntity
expected string
}{
{"JA1ABC", "JA", "JA1"},
{"LU/G3XYZ", "LU", "LU0"},
{"W8/G3XYZ", "K", "K8"},
{"K5ZD", "K", "K5"},
{"K5ZD/1", "K", "K1"},
{"XK2ABC", "VE", "VE2"},
}
for _, tc := range tt {
t.Run(tc.call, func(t *testing.T) {
actual := VeronEntity(callsign.MustParse(tc.call), tc.dxccEntity)
assert.Equal(t, tc.expected, actual)
})
}
}
func TestCanadianTerritory(t *testing.T) {
tt := []struct {
call string
expected string
}{
{"VE2ABC", "VE2"},
{"VA2ABC", "VE2"},
{"CG2ABC", "VE2"},
{"XK2ABC", "VE2"},
{"VO1ABC", "VO1"},
{"VY1ABC", "VY1"},
}
for _, tc := range tt {
t.Run(tc.call, func(t *testing.T) {
actual := CanadianTerritory(callsign.MustParse(tc.call))
assert.Equal(t, tc.expected, actual)
})
}
}