30 lines
513 B
Go
30 lines
513 B
Go
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))
|
|
}
|
|
}
|