protocol/aprs: refactored
This commit is contained in:
29
protocol/aprs/data_test.go
Normal file
29
protocol/aprs/data_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package aprs
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testCompareData(t *testing.T, want, test Data) {
|
||||
t.Helper()
|
||||
|
||||
if want == nil && test != nil {
|
||||
t.Errorf("expected no data, got %T", test)
|
||||
return
|
||||
}
|
||||
if want != nil && test == nil {
|
||||
t.Errorf("expected data %T, got nil", want)
|
||||
return
|
||||
}
|
||||
|
||||
if reflect.TypeOf(want) != reflect.TypeOf(test) {
|
||||
t.Errorf("expected data %T, got %T", want, test)
|
||||
return
|
||||
}
|
||||
|
||||
switch want := want.(type) {
|
||||
case *Position:
|
||||
testComparePosition(t, want, test.(*Position))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user