add generator test for skylab
This commit is contained in:
parent
c8034066c9
commit
1ff4adf5e4
1275
skylab/skylab_gen.go
1275
skylab/skylab_gen.go
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
|
@ -3,6 +3,7 @@ package skylab
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"reflect"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -44,4 +45,20 @@ func TestJSON{{$structName}}(t *testing.T) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCanFrame{{$structName}}(t *testing.T) {
|
||||||
|
v := &{{$structName}}{}
|
||||||
|
frame, err := ToCanFrame(v)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("expected no error, got %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
retpkt, err := FromCanFrame(frame)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("expected no error, got %v", err)
|
||||||
|
}
|
||||||
|
if !reflect.DeepEqual(v, retpkt) {
|
||||||
|
t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
Loading…
Reference in a new issue