You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/08/02 09:38:03 UTC
[plc4x] 03/03: test(plc4go/cbus): fixed some issues during connection setup and fallback for random sal
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit da22859fc74497088b07f92fe83823cebe23402c
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Aug 2 10:59:20 2022 +0200
test(plc4go/cbus): fixed some issues during connection setup and fallback for random sal
---
plc4go/internal/cbus/Connection.go | 18 +-
plc4go/internal/cbus/MessageCodec.go | 8 +
.../cbus/readwrite/model/StaticHelper_test.go | 646 +++++++++++++++++++++
3 files changed, 663 insertions(+), 9 deletions(-)
diff --git a/plc4go/internal/cbus/Connection.go b/plc4go/internal/cbus/Connection.go
index 196c230aa..f6a991692 100644
--- a/plc4go/internal/cbus/Connection.go
+++ b/plc4go/internal/cbus/Connection.go
@@ -227,6 +227,7 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
c.fireConnectionError(errors.Errorf("Timeout after %v", timeout), ch)
return
}
+ log.Debug().Msg("Reset done")
}
{
log.Debug().Msg("Set application filter to all")
@@ -234,36 +235,34 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
if !c.sendCalDataWrite(ch, readWriteModel.Parameter_APPLICATION_ADDRESS_1, applicationAddress1, requestContext, cbusOptions) {
return
}
+ log.Debug().Msg("Application filter set")
}
{
log.Debug().Msg("Set interface options 3")
interfaceOptions3 := readWriteModel.NewParameterValueInterfaceOptions3(readWriteModel.NewInterfaceOptions3(true, false, true, false), 1)
- var newCBusOptions readWriteModel.CBusOptions
- newCBusOptions = readWriteModel.NewCBusOptions(false, false, false, true, false, false, false, false, false)
- cbusOptions = &newCBusOptions
if !c.sendCalDataWrite(ch, readWriteModel.Parameter_INTERFACE_OPTIONS_3, interfaceOptions3, requestContext, cbusOptions) {
return
}
+ *cbusOptions = readWriteModel.NewCBusOptions(false, false, false, true, false, false, false, false, false)
+ log.Debug().Msg("Interface options 3 set")
}
{
log.Debug().Msg("Set interface options 1 power up settings")
- var newCBusOptions readWriteModel.CBusOptions
- newCBusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
- cbusOptions = &newCBusOptions
interfaceOptions1PowerUpSettings := readWriteModel.NewParameterValueInterfaceOptions1PowerUpSettings(readWriteModel.NewInterfaceOptions1PowerUpSettings(readWriteModel.NewInterfaceOptions1(true, true, true, true, false, true)), 1)
if !c.sendCalDataWrite(ch, readWriteModel.Parameter_INTERFACE_OPTIONS_1_POWER_UP_SETTINGS, interfaceOptions1PowerUpSettings, requestContext, cbusOptions) {
return
}
+ *cbusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
+ log.Debug().Msg("Interface options 1 power up settings set")
}
{
log.Debug().Msg("Set interface options 1")
- var newCBusOptions readWriteModel.CBusOptions
- newCBusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
- cbusOptions = &newCBusOptions
interfaceOptions1 := readWriteModel.NewParameterValueInterfaceOptions1(readWriteModel.NewInterfaceOptions1(true, true, true, true, false, true), 1)
if !c.sendCalDataWrite(ch, readWriteModel.Parameter_INTERFACE_OPTIONS_1, interfaceOptions1, requestContext, cbusOptions) {
return
}
+ *cbusOptions = readWriteModel.NewCBusOptions(false, true, true, true, true, false, false, false, true)
+ log.Debug().Msg("Interface options 1 set")
}
c.fireConnected(ch)
@@ -278,6 +277,7 @@ func (c *Connection) setupConnection(ch chan plc4go.PlcConnectionConnectResult)
}
}
}()
+ log.Debug().Msg("Subscription handler stated")
}
func (c *Connection) sendCalDataWrite(ch chan plc4go.PlcConnectionConnectResult, paramNo readWriteModel.Parameter, parameterValue readWriteModel.ParameterValue, requestContext *readWriteModel.RequestContext, cbusOptions *readWriteModel.CBusOptions) bool {
diff --git a/plc4go/internal/cbus/MessageCodec.go b/plc4go/internal/cbus/MessageCodec.go
index 0570da211..8db9ff1bb 100644
--- a/plc4go/internal/cbus/MessageCodec.go
+++ b/plc4go/internal/cbus/MessageCodec.go
@@ -178,6 +178,14 @@ lookingForTheEnd:
rb := utils.NewReadBufferByteBased(read)
cBusMessage, err := readwriteModel.CBusMessageParse(rb, pciResponse, m.requestContext, m.cbusOptions)
if err != nil {
+ // TODO: bit bad we need to do this but cal detection is not reliable enough
+ rb := utils.NewReadBufferByteBased(read)
+ cBusMessage, secondErr := readwriteModel.CBusMessageParse(rb, pciResponse, readwriteModel.NewRequestContext(false, false, false), m.cbusOptions)
+ if secondErr == nil {
+ return cBusMessage, nil
+ } else {
+ log.Debug().Err(secondErr).Msg("Second parse failed too")
+ }
log.Warn().Err(err).Msg("error parsing")
// TODO: Possibly clean up ...
return nil, nil
diff --git a/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go b/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
new file mode 100644
index 000000000..04eab1177
--- /dev/null
+++ b/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
@@ -0,0 +1,646 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package model
+
+import (
+ "github.com/apache/plc4x/plc4go/internal/spi"
+ "github.com/apache/plc4x/plc4go/internal/spi/utils"
+ "reflect"
+ "testing"
+)
+
+func TestCalculateChecksum(t *testing.T) {
+ type args struct {
+ writeBuffer utils.WriteBuffer
+ message spi.Message
+ srchk bool
+ }
+ tests := []struct {
+ name string
+ args args
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if err := CalculateChecksum(tt.args.writeBuffer, tt.args.message, tt.args.srchk); (err != nil) != tt.wantErr {
+ t.Errorf("CalculateChecksum() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ })
+ }
+}
+
+func TestKnowsAccessControlCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsAccessControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsAccessControlCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsAirConditioningCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsAirConditioningCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsAirConditioningCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsCALCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsCALCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsCALCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsClockAndTimekeepingCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsClockAndTimekeepingCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsClockAndTimekeepingCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsEnableControlCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsEnableControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsEnableControlCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsErrorReportingCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsErrorReportingCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsErrorReportingCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsLightingCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsLightingCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsLightingCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsMeasurementCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsMeasurementCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsMeasurementCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsMediaTransportControlCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsMediaTransportControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsMediaTransportControlCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsMeteringCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsMeteringCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsMeteringCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsSecurityCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsSecurityCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsSecurityCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsTelephonyCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsTelephonyCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsTelephonyCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsTemperatureBroadcastCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsTemperatureBroadcastCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsTemperatureBroadcastCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestKnowsTriggerControlCommandTypeContainer(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := KnowsTriggerControlCommandTypeContainer(tt.args.readBuffer); got != tt.want {
+ t.Errorf("KnowsTriggerControlCommandTypeContainer() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestReadAndValidateChecksum(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ message spi.Message
+ srchk bool
+ }
+ tests := []struct {
+ name string
+ args args
+ want Checksum
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := ReadAndValidateChecksum(tt.args.readBuffer, tt.args.message, tt.args.srchk)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("ReadAndValidateChecksum() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("ReadAndValidateChecksum() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestReadCALData(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want CALData
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := ReadCALData(tt.args.readBuffer)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("ReadCALData() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("ReadCALData() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestReadCBusCommand(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ cBusOptions CBusOptions
+ srchk bool
+ }
+ tests := []struct {
+ name string
+ args args
+ want CBusCommand
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := ReadCBusCommand(tt.args.readBuffer, tt.args.cBusOptions, tt.args.srchk)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("ReadCBusCommand() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("ReadCBusCommand() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestReadEncodedReply(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ options CBusOptions
+ requestContext RequestContext
+ srchk bool
+ }
+ tests := []struct {
+ name string
+ args args
+ want EncodedReply
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := ReadEncodedReply(tt.args.readBuffer, tt.args.options, tt.args.requestContext, tt.args.srchk)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("ReadEncodedReply() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("ReadEncodedReply() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func TestWriteCALData(t *testing.T) {
+ type args struct {
+ writeBuffer utils.WriteBuffer
+ calData CALData
+ }
+ tests := []struct {
+ name string
+ args args
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if err := WriteCALData(tt.args.writeBuffer, tt.args.calData); (err != nil) != tt.wantErr {
+ t.Errorf("WriteCALData() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ })
+ }
+}
+
+func TestWriteCBusCommand(t *testing.T) {
+ type args struct {
+ writeBuffer utils.WriteBuffer
+ cbusCommand CBusCommand
+ }
+ tests := []struct {
+ name string
+ args args
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if err := WriteCBusCommand(tt.args.writeBuffer, tt.args.cbusCommand); (err != nil) != tt.wantErr {
+ t.Errorf("WriteCBusCommand() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ })
+ }
+}
+
+func TestWriteEncodedReply(t *testing.T) {
+ type args struct {
+ writeBuffer utils.WriteBuffer
+ encodedReply EncodedReply
+ }
+ tests := []struct {
+ name string
+ args args
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if err := WriteEncodedReply(tt.args.writeBuffer, tt.args.encodedReply); (err != nil) != tt.wantErr {
+ t.Errorf("WriteEncodedReply() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ })
+ }
+}
+
+func Test_encodeHexUpperCase(t *testing.T) {
+ type args struct {
+ dst []byte
+ src []byte
+ }
+ tests := []struct {
+ name string
+ args args
+ want int
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := encodeHexUpperCase(tt.args.dst, tt.args.src); got != tt.want {
+ t.Errorf("encodeHexUpperCase() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func Test_findHexEnd(t *testing.T) {
+ type args struct {
+ readBuffer utils.ReadBuffer
+ }
+ tests := []struct {
+ name string
+ args args
+ want int
+ }{
+ {
+ name: "sal end",
+ args: args{readBuffer: utils.NewReadBufferByteBased([]byte("0500380022AFE012"))},
+ want: 16,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := findHexEnd(tt.args.readBuffer); got != tt.want {
+ t.Errorf("findHexEnd() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func Test_getChecksum(t *testing.T) {
+ type args struct {
+ message spi.Message
+ }
+ tests := []struct {
+ name string
+ args args
+ want byte
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := getChecksum(tt.args.message)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("getChecksum() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if got != tt.want {
+ t.Errorf("getChecksum() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func Test_readBytesFromHex(t *testing.T) {
+ type args struct {
+ logicalName string
+ readBuffer utils.ReadBuffer
+ srchk bool
+ }
+ tests := []struct {
+ name string
+ args args
+ want []byte
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ got, err := readBytesFromHex(tt.args.logicalName, tt.args.readBuffer, tt.args.srchk)
+ if (err != nil) != tt.wantErr {
+ t.Errorf("readBytesFromHex() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("readBytesFromHex() got = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func Test_writeSerializableToHex(t *testing.T) {
+ type args struct {
+ logicalName string
+ writeBuffer utils.WriteBuffer
+ serializable utils.Serializable
+ }
+ tests := []struct {
+ name string
+ args args
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if err := writeSerializableToHex(tt.args.logicalName, tt.args.writeBuffer, tt.args.serializable); (err != nil) != tt.wantErr {
+ t.Errorf("writeSerializableToHex() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ })
+ }
+}
+
+func Test_writeToHex(t *testing.T) {
+ type args struct {
+ logicalName string
+ writeBuffer utils.WriteBuffer
+ bytesToWrite []byte
+ }
+ tests := []struct {
+ name string
+ args args
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if err := writeToHex(tt.args.logicalName, tt.args.writeBuffer, tt.args.bytesToWrite); (err != nil) != tt.wantErr {
+ t.Errorf("writeToHex() error = %v, wantErr %v", err, tt.wantErr)
+ }
+ })
+ }
+}