add generator test for skylab

This commit is contained in:
saji 2024-03-07 13:29:50 -06:00
parent c8034066c9
commit 1ff4adf5e4
3 changed files with 2280 additions and 547 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -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 }}