Simple app to transform IEC 61851-24 CAN bus dump to human readable messages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chademo-log/files_test.go

38 lines
732 B

package main
import (
"reflect"
"testing"
)
func TestFromString(t *testing.T) {
type args struct {
text *string
}
var dump = "(2022-07-08 16:54:15.587099) can0 100 [8] 00 00 00 00 00 00 64 00"
tests := []struct {
name string
args args
want *CanFrame
}{
// TODO: Add test cases.
{
name: "Candump parsing test",
args: args{text: &dump},
want: &CanFrame{
canid: CAN_ID_100,
date: "2022-07-08 16:54:15.587099",
payload: []uint8{0, 0, 0, 0, 0, 0, 0x64, 0},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := fromString(tt.args.text); !reflect.DeepEqual(got, tt.want) {
t.Errorf("fromString() = %v, want %v", got, tt.want)
}
})
}
}