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 2023/06/07 13:08:08 UTC
[plc4x] 03/03: test(plc4go/cbus): add tests for static helper
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 b744cc9afdcf196b5ab67b30f764a5167ae2f359
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Jun 7 15:07:56 2023 +0200
test(plc4go/cbus): add tests for static helper
---
plc4go/internal/eip/mock_EIPPlcTag_test.go | 407 ---------------------
plc4go/internal/eip/mock_PlcTag_test.go | 407 +++++++++++++++++++++
plc4go/internal/simulated/mock_Tag_test.go | 28 +-
.../cbus/readwrite/model/StaticHelper_test.go | 300 +++++++++++++--
4 files changed, 690 insertions(+), 452 deletions(-)
diff --git a/plc4go/internal/eip/mock_EIPPlcTag_test.go b/plc4go/internal/eip/mock_EIPPlcTag_test.go
deleted file mode 100644
index 449e7f6298..0000000000
--- a/plc4go/internal/eip/mock_EIPPlcTag_test.go
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * 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.
- */
-
-// Code generated by mockery v2.28.2. DO NOT EDIT.
-
-package eip
-
-import (
- context "context"
-
- model "github.com/apache/plc4x/plc4go/pkg/api/model"
- mock "github.com/stretchr/testify/mock"
-
- readwritemodel "github.com/apache/plc4x/plc4go/protocols/eip/readwrite/model"
-
- utils "github.com/apache/plc4x/plc4go/spi/utils"
-
- values "github.com/apache/plc4x/plc4go/pkg/api/values"
-)
-
-// MockEIPPlcTag is an autogenerated mock type for the PlcTag type
-type MockEIPPlcTag struct {
- mock.Mock
-}
-
-type MockEIPPlcTag_Expecter struct {
- mock *mock.Mock
-}
-
-func (_m *MockEIPPlcTag) EXPECT() *MockEIPPlcTag_Expecter {
- return &MockEIPPlcTag_Expecter{mock: &_m.Mock}
-}
-
-// GetAddressString provides a mock function with given fields:
-func (_m *MockEIPPlcTag) GetAddressString() string {
- ret := _m.Called()
-
- var r0 string
- if rf, ok := ret.Get(0).(func() string); ok {
- r0 = rf()
- } else {
- r0 = ret.Get(0).(string)
- }
-
- return r0
-}
-
-// MockEIPPlcTag_GetAddressString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAddressString'
-type MockEIPPlcTag_GetAddressString_Call struct {
- *mock.Call
-}
-
-// GetAddressString is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) GetAddressString() *MockEIPPlcTag_GetAddressString_Call {
- return &MockEIPPlcTag_GetAddressString_Call{Call: _e.mock.On("GetAddressString")}
-}
-
-func (_c *MockEIPPlcTag_GetAddressString_Call) Run(run func()) *MockEIPPlcTag_GetAddressString_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetAddressString_Call) Return(_a0 string) *MockEIPPlcTag_GetAddressString_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetAddressString_Call) RunAndReturn(run func() string) *MockEIPPlcTag_GetAddressString_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// GetArrayInfo provides a mock function with given fields:
-func (_m *MockEIPPlcTag) GetArrayInfo() []model.ArrayInfo {
- ret := _m.Called()
-
- var r0 []model.ArrayInfo
- if rf, ok := ret.Get(0).(func() []model.ArrayInfo); ok {
- r0 = rf()
- } else {
- if ret.Get(0) != nil {
- r0 = ret.Get(0).([]model.ArrayInfo)
- }
- }
-
- return r0
-}
-
-// MockEIPPlcTag_GetArrayInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetArrayInfo'
-type MockEIPPlcTag_GetArrayInfo_Call struct {
- *mock.Call
-}
-
-// GetArrayInfo is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) GetArrayInfo() *MockEIPPlcTag_GetArrayInfo_Call {
- return &MockEIPPlcTag_GetArrayInfo_Call{Call: _e.mock.On("GetArrayInfo")}
-}
-
-func (_c *MockEIPPlcTag_GetArrayInfo_Call) Run(run func()) *MockEIPPlcTag_GetArrayInfo_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetArrayInfo_Call) Return(_a0 []model.ArrayInfo) *MockEIPPlcTag_GetArrayInfo_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetArrayInfo_Call) RunAndReturn(run func() []model.ArrayInfo) *MockEIPPlcTag_GetArrayInfo_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// GetElementNb provides a mock function with given fields:
-func (_m *MockEIPPlcTag) GetElementNb() uint16 {
- ret := _m.Called()
-
- var r0 uint16
- if rf, ok := ret.Get(0).(func() uint16); ok {
- r0 = rf()
- } else {
- r0 = ret.Get(0).(uint16)
- }
-
- return r0
-}
-
-// MockEIPPlcTag_GetElementNb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetElementNb'
-type MockEIPPlcTag_GetElementNb_Call struct {
- *mock.Call
-}
-
-// GetElementNb is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) GetElementNb() *MockEIPPlcTag_GetElementNb_Call {
- return &MockEIPPlcTag_GetElementNb_Call{Call: _e.mock.On("GetElementNb")}
-}
-
-func (_c *MockEIPPlcTag_GetElementNb_Call) Run(run func()) *MockEIPPlcTag_GetElementNb_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetElementNb_Call) Return(_a0 uint16) *MockEIPPlcTag_GetElementNb_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetElementNb_Call) RunAndReturn(run func() uint16) *MockEIPPlcTag_GetElementNb_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// GetTag provides a mock function with given fields:
-func (_m *MockEIPPlcTag) GetTag() string {
- ret := _m.Called()
-
- var r0 string
- if rf, ok := ret.Get(0).(func() string); ok {
- r0 = rf()
- } else {
- r0 = ret.Get(0).(string)
- }
-
- return r0
-}
-
-// MockEIPPlcTag_GetTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTag'
-type MockEIPPlcTag_GetTag_Call struct {
- *mock.Call
-}
-
-// GetTag is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) GetTag() *MockEIPPlcTag_GetTag_Call {
- return &MockEIPPlcTag_GetTag_Call{Call: _e.mock.On("GetTag")}
-}
-
-func (_c *MockEIPPlcTag_GetTag_Call) Run(run func()) *MockEIPPlcTag_GetTag_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetTag_Call) Return(_a0 string) *MockEIPPlcTag_GetTag_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetTag_Call) RunAndReturn(run func() string) *MockEIPPlcTag_GetTag_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// GetType provides a mock function with given fields:
-func (_m *MockEIPPlcTag) GetType() readwritemodel.CIPDataTypeCode {
- ret := _m.Called()
-
- var r0 readwritemodel.CIPDataTypeCode
- if rf, ok := ret.Get(0).(func() readwritemodel.CIPDataTypeCode); ok {
- r0 = rf()
- } else {
- r0 = ret.Get(0).(readwritemodel.CIPDataTypeCode)
- }
-
- return r0
-}
-
-// MockEIPPlcTag_GetType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetType'
-type MockEIPPlcTag_GetType_Call struct {
- *mock.Call
-}
-
-// GetType is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) GetType() *MockEIPPlcTag_GetType_Call {
- return &MockEIPPlcTag_GetType_Call{Call: _e.mock.On("GetType")}
-}
-
-func (_c *MockEIPPlcTag_GetType_Call) Run(run func()) *MockEIPPlcTag_GetType_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetType_Call) Return(_a0 readwritemodel.CIPDataTypeCode) *MockEIPPlcTag_GetType_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetType_Call) RunAndReturn(run func() readwritemodel.CIPDataTypeCode) *MockEIPPlcTag_GetType_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// GetValueType provides a mock function with given fields:
-func (_m *MockEIPPlcTag) GetValueType() values.PlcValueType {
- ret := _m.Called()
-
- var r0 values.PlcValueType
- if rf, ok := ret.Get(0).(func() values.PlcValueType); ok {
- r0 = rf()
- } else {
- r0 = ret.Get(0).(values.PlcValueType)
- }
-
- return r0
-}
-
-// MockEIPPlcTag_GetValueType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValueType'
-type MockEIPPlcTag_GetValueType_Call struct {
- *mock.Call
-}
-
-// GetValueType is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) GetValueType() *MockEIPPlcTag_GetValueType_Call {
- return &MockEIPPlcTag_GetValueType_Call{Call: _e.mock.On("GetValueType")}
-}
-
-func (_c *MockEIPPlcTag_GetValueType_Call) Run(run func()) *MockEIPPlcTag_GetValueType_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetValueType_Call) Return(_a0 values.PlcValueType) *MockEIPPlcTag_GetValueType_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_GetValueType_Call) RunAndReturn(run func() values.PlcValueType) *MockEIPPlcTag_GetValueType_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// Serialize provides a mock function with given fields:
-func (_m *MockEIPPlcTag) Serialize() ([]byte, error) {
- ret := _m.Called()
-
- var r0 []byte
- var r1 error
- if rf, ok := ret.Get(0).(func() ([]byte, error)); ok {
- return rf()
- }
- if rf, ok := ret.Get(0).(func() []byte); ok {
- r0 = rf()
- } else {
- if ret.Get(0) != nil {
- r0 = ret.Get(0).([]byte)
- }
- }
-
- if rf, ok := ret.Get(1).(func() error); ok {
- r1 = rf()
- } else {
- r1 = ret.Error(1)
- }
-
- return r0, r1
-}
-
-// MockEIPPlcTag_Serialize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Serialize'
-type MockEIPPlcTag_Serialize_Call struct {
- *mock.Call
-}
-
-// Serialize is a helper method to define mock.On call
-func (_e *MockEIPPlcTag_Expecter) Serialize() *MockEIPPlcTag_Serialize_Call {
- return &MockEIPPlcTag_Serialize_Call{Call: _e.mock.On("Serialize")}
-}
-
-func (_c *MockEIPPlcTag_Serialize_Call) Run(run func()) *MockEIPPlcTag_Serialize_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run()
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_Serialize_Call) Return(_a0 []byte, _a1 error) *MockEIPPlcTag_Serialize_Call {
- _c.Call.Return(_a0, _a1)
- return _c
-}
-
-func (_c *MockEIPPlcTag_Serialize_Call) RunAndReturn(run func() ([]byte, error)) *MockEIPPlcTag_Serialize_Call {
- _c.Call.Return(run)
- return _c
-}
-
-// SerializeWithWriteBuffer provides a mock function with given fields: ctx, writeBuffer
-func (_m *MockEIPPlcTag) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error {
- ret := _m.Called(ctx, writeBuffer)
-
- var r0 error
- if rf, ok := ret.Get(0).(func(context.Context, utils.WriteBuffer) error); ok {
- r0 = rf(ctx, writeBuffer)
- } else {
- r0 = ret.Error(0)
- }
-
- return r0
-}
-
-// MockEIPPlcTag_SerializeWithWriteBuffer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SerializeWithWriteBuffer'
-type MockEIPPlcTag_SerializeWithWriteBuffer_Call struct {
- *mock.Call
-}
-
-// SerializeWithWriteBuffer is a helper method to define mock.On call
-// - ctx context.Context
-// - writeBuffer utils.WriteBuffer
-func (_e *MockEIPPlcTag_Expecter) SerializeWithWriteBuffer(ctx interface{}, writeBuffer interface{}) *MockEIPPlcTag_SerializeWithWriteBuffer_Call {
- return &MockEIPPlcTag_SerializeWithWriteBuffer_Call{Call: _e.mock.On("SerializeWithWriteBuffer", ctx, writeBuffer)}
-}
-
-func (_c *MockEIPPlcTag_SerializeWithWriteBuffer_Call) Run(run func(ctx context.Context, writeBuffer utils.WriteBuffer)) *MockEIPPlcTag_SerializeWithWriteBuffer_Call {
- _c.Call.Run(func(args mock.Arguments) {
- run(args[0].(context.Context), args[1].(utils.WriteBuffer))
- })
- return _c
-}
-
-func (_c *MockEIPPlcTag_SerializeWithWriteBuffer_Call) Return(_a0 error) *MockEIPPlcTag_SerializeWithWriteBuffer_Call {
- _c.Call.Return(_a0)
- return _c
-}
-
-func (_c *MockEIPPlcTag_SerializeWithWriteBuffer_Call) RunAndReturn(run func(context.Context, utils.WriteBuffer) error) *MockEIPPlcTag_SerializeWithWriteBuffer_Call {
- _c.Call.Return(run)
- return _c
-}
-
-type mockConstructorTestingTNewMockEIPPlcTag interface {
- mock.TestingT
- Cleanup(func())
-}
-
-// NewMockEIPPlcTag creates a new instance of MockEIPPlcTag. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
-func NewMockEIPPlcTag(t mockConstructorTestingTNewMockEIPPlcTag) *MockEIPPlcTag {
- mock := &MockEIPPlcTag{}
- mock.Mock.Test(t)
-
- t.Cleanup(func() { mock.AssertExpectations(t) })
-
- return mock
-}
diff --git a/plc4go/internal/eip/mock_PlcTag_test.go b/plc4go/internal/eip/mock_PlcTag_test.go
new file mode 100644
index 0000000000..4d0bc4cc01
--- /dev/null
+++ b/plc4go/internal/eip/mock_PlcTag_test.go
@@ -0,0 +1,407 @@
+/*
+ * 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.
+ */
+
+// Code generated by mockery v2.28.2. DO NOT EDIT.
+
+package eip
+
+import (
+ context "context"
+
+ model "github.com/apache/plc4x/plc4go/pkg/api/model"
+ mock "github.com/stretchr/testify/mock"
+
+ readwritemodel "github.com/apache/plc4x/plc4go/protocols/eip/readwrite/model"
+
+ utils "github.com/apache/plc4x/plc4go/spi/utils"
+
+ values "github.com/apache/plc4x/plc4go/pkg/api/values"
+)
+
+// MockPlcTag is an autogenerated mock type for the PlcTag type
+type MockPlcTag struct {
+ mock.Mock
+}
+
+type MockPlcTag_Expecter struct {
+ mock *mock.Mock
+}
+
+func (_m *MockPlcTag) EXPECT() *MockPlcTag_Expecter {
+ return &MockPlcTag_Expecter{mock: &_m.Mock}
+}
+
+// GetAddressString provides a mock function with given fields:
+func (_m *MockPlcTag) GetAddressString() string {
+ ret := _m.Called()
+
+ var r0 string
+ if rf, ok := ret.Get(0).(func() string); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(string)
+ }
+
+ return r0
+}
+
+// MockPlcTag_GetAddressString_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAddressString'
+type MockPlcTag_GetAddressString_Call struct {
+ *mock.Call
+}
+
+// GetAddressString is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) GetAddressString() *MockPlcTag_GetAddressString_Call {
+ return &MockPlcTag_GetAddressString_Call{Call: _e.mock.On("GetAddressString")}
+}
+
+func (_c *MockPlcTag_GetAddressString_Call) Run(run func()) *MockPlcTag_GetAddressString_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_GetAddressString_Call) Return(_a0 string) *MockPlcTag_GetAddressString_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_GetAddressString_Call) RunAndReturn(run func() string) *MockPlcTag_GetAddressString_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// GetArrayInfo provides a mock function with given fields:
+func (_m *MockPlcTag) GetArrayInfo() []model.ArrayInfo {
+ ret := _m.Called()
+
+ var r0 []model.ArrayInfo
+ if rf, ok := ret.Get(0).(func() []model.ArrayInfo); ok {
+ r0 = rf()
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).([]model.ArrayInfo)
+ }
+ }
+
+ return r0
+}
+
+// MockPlcTag_GetArrayInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetArrayInfo'
+type MockPlcTag_GetArrayInfo_Call struct {
+ *mock.Call
+}
+
+// GetArrayInfo is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) GetArrayInfo() *MockPlcTag_GetArrayInfo_Call {
+ return &MockPlcTag_GetArrayInfo_Call{Call: _e.mock.On("GetArrayInfo")}
+}
+
+func (_c *MockPlcTag_GetArrayInfo_Call) Run(run func()) *MockPlcTag_GetArrayInfo_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_GetArrayInfo_Call) Return(_a0 []model.ArrayInfo) *MockPlcTag_GetArrayInfo_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_GetArrayInfo_Call) RunAndReturn(run func() []model.ArrayInfo) *MockPlcTag_GetArrayInfo_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// GetElementNb provides a mock function with given fields:
+func (_m *MockPlcTag) GetElementNb() uint16 {
+ ret := _m.Called()
+
+ var r0 uint16
+ if rf, ok := ret.Get(0).(func() uint16); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(uint16)
+ }
+
+ return r0
+}
+
+// MockPlcTag_GetElementNb_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetElementNb'
+type MockPlcTag_GetElementNb_Call struct {
+ *mock.Call
+}
+
+// GetElementNb is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) GetElementNb() *MockPlcTag_GetElementNb_Call {
+ return &MockPlcTag_GetElementNb_Call{Call: _e.mock.On("GetElementNb")}
+}
+
+func (_c *MockPlcTag_GetElementNb_Call) Run(run func()) *MockPlcTag_GetElementNb_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_GetElementNb_Call) Return(_a0 uint16) *MockPlcTag_GetElementNb_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_GetElementNb_Call) RunAndReturn(run func() uint16) *MockPlcTag_GetElementNb_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// GetTag provides a mock function with given fields:
+func (_m *MockPlcTag) GetTag() string {
+ ret := _m.Called()
+
+ var r0 string
+ if rf, ok := ret.Get(0).(func() string); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(string)
+ }
+
+ return r0
+}
+
+// MockPlcTag_GetTag_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTag'
+type MockPlcTag_GetTag_Call struct {
+ *mock.Call
+}
+
+// GetTag is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) GetTag() *MockPlcTag_GetTag_Call {
+ return &MockPlcTag_GetTag_Call{Call: _e.mock.On("GetTag")}
+}
+
+func (_c *MockPlcTag_GetTag_Call) Run(run func()) *MockPlcTag_GetTag_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_GetTag_Call) Return(_a0 string) *MockPlcTag_GetTag_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_GetTag_Call) RunAndReturn(run func() string) *MockPlcTag_GetTag_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// GetType provides a mock function with given fields:
+func (_m *MockPlcTag) GetType() readwritemodel.CIPDataTypeCode {
+ ret := _m.Called()
+
+ var r0 readwritemodel.CIPDataTypeCode
+ if rf, ok := ret.Get(0).(func() readwritemodel.CIPDataTypeCode); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(readwritemodel.CIPDataTypeCode)
+ }
+
+ return r0
+}
+
+// MockPlcTag_GetType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetType'
+type MockPlcTag_GetType_Call struct {
+ *mock.Call
+}
+
+// GetType is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) GetType() *MockPlcTag_GetType_Call {
+ return &MockPlcTag_GetType_Call{Call: _e.mock.On("GetType")}
+}
+
+func (_c *MockPlcTag_GetType_Call) Run(run func()) *MockPlcTag_GetType_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_GetType_Call) Return(_a0 readwritemodel.CIPDataTypeCode) *MockPlcTag_GetType_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_GetType_Call) RunAndReturn(run func() readwritemodel.CIPDataTypeCode) *MockPlcTag_GetType_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// GetValueType provides a mock function with given fields:
+func (_m *MockPlcTag) GetValueType() values.PlcValueType {
+ ret := _m.Called()
+
+ var r0 values.PlcValueType
+ if rf, ok := ret.Get(0).(func() values.PlcValueType); ok {
+ r0 = rf()
+ } else {
+ r0 = ret.Get(0).(values.PlcValueType)
+ }
+
+ return r0
+}
+
+// MockPlcTag_GetValueType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValueType'
+type MockPlcTag_GetValueType_Call struct {
+ *mock.Call
+}
+
+// GetValueType is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) GetValueType() *MockPlcTag_GetValueType_Call {
+ return &MockPlcTag_GetValueType_Call{Call: _e.mock.On("GetValueType")}
+}
+
+func (_c *MockPlcTag_GetValueType_Call) Run(run func()) *MockPlcTag_GetValueType_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_GetValueType_Call) Return(_a0 values.PlcValueType) *MockPlcTag_GetValueType_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_GetValueType_Call) RunAndReturn(run func() values.PlcValueType) *MockPlcTag_GetValueType_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// Serialize provides a mock function with given fields:
+func (_m *MockPlcTag) Serialize() ([]byte, error) {
+ ret := _m.Called()
+
+ var r0 []byte
+ var r1 error
+ if rf, ok := ret.Get(0).(func() ([]byte, error)); ok {
+ return rf()
+ }
+ if rf, ok := ret.Get(0).(func() []byte); ok {
+ r0 = rf()
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).([]byte)
+ }
+ }
+
+ if rf, ok := ret.Get(1).(func() error); ok {
+ r1 = rf()
+ } else {
+ r1 = ret.Error(1)
+ }
+
+ return r0, r1
+}
+
+// MockPlcTag_Serialize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Serialize'
+type MockPlcTag_Serialize_Call struct {
+ *mock.Call
+}
+
+// Serialize is a helper method to define mock.On call
+func (_e *MockPlcTag_Expecter) Serialize() *MockPlcTag_Serialize_Call {
+ return &MockPlcTag_Serialize_Call{Call: _e.mock.On("Serialize")}
+}
+
+func (_c *MockPlcTag_Serialize_Call) Run(run func()) *MockPlcTag_Serialize_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run()
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_Serialize_Call) Return(_a0 []byte, _a1 error) *MockPlcTag_Serialize_Call {
+ _c.Call.Return(_a0, _a1)
+ return _c
+}
+
+func (_c *MockPlcTag_Serialize_Call) RunAndReturn(run func() ([]byte, error)) *MockPlcTag_Serialize_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+// SerializeWithWriteBuffer provides a mock function with given fields: ctx, writeBuffer
+func (_m *MockPlcTag) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error {
+ ret := _m.Called(ctx, writeBuffer)
+
+ var r0 error
+ if rf, ok := ret.Get(0).(func(context.Context, utils.WriteBuffer) error); ok {
+ r0 = rf(ctx, writeBuffer)
+ } else {
+ r0 = ret.Error(0)
+ }
+
+ return r0
+}
+
+// MockPlcTag_SerializeWithWriteBuffer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SerializeWithWriteBuffer'
+type MockPlcTag_SerializeWithWriteBuffer_Call struct {
+ *mock.Call
+}
+
+// SerializeWithWriteBuffer is a helper method to define mock.On call
+// - ctx context.Context
+// - writeBuffer utils.WriteBuffer
+func (_e *MockPlcTag_Expecter) SerializeWithWriteBuffer(ctx interface{}, writeBuffer interface{}) *MockPlcTag_SerializeWithWriteBuffer_Call {
+ return &MockPlcTag_SerializeWithWriteBuffer_Call{Call: _e.mock.On("SerializeWithWriteBuffer", ctx, writeBuffer)}
+}
+
+func (_c *MockPlcTag_SerializeWithWriteBuffer_Call) Run(run func(ctx context.Context, writeBuffer utils.WriteBuffer)) *MockPlcTag_SerializeWithWriteBuffer_Call {
+ _c.Call.Run(func(args mock.Arguments) {
+ run(args[0].(context.Context), args[1].(utils.WriteBuffer))
+ })
+ return _c
+}
+
+func (_c *MockPlcTag_SerializeWithWriteBuffer_Call) Return(_a0 error) *MockPlcTag_SerializeWithWriteBuffer_Call {
+ _c.Call.Return(_a0)
+ return _c
+}
+
+func (_c *MockPlcTag_SerializeWithWriteBuffer_Call) RunAndReturn(run func(context.Context, utils.WriteBuffer) error) *MockPlcTag_SerializeWithWriteBuffer_Call {
+ _c.Call.Return(run)
+ return _c
+}
+
+type mockConstructorTestingTNewMockPlcTag interface {
+ mock.TestingT
+ Cleanup(func())
+}
+
+// NewMockPlcTag creates a new instance of MockPlcTag. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
+func NewMockPlcTag(t mockConstructorTestingTNewMockPlcTag) *MockPlcTag {
+ mock := &MockPlcTag{}
+ mock.Mock.Test(t)
+
+ t.Cleanup(func() { mock.AssertExpectations(t) })
+
+ return mock
+}
diff --git a/plc4go/internal/simulated/mock_Tag_test.go b/plc4go/internal/simulated/mock_Tag_test.go
index 0e0e84551f..4c01d7a522 100644
--- a/plc4go/internal/simulated/mock_Tag_test.go
+++ b/plc4go/internal/simulated/mock_Tag_test.go
@@ -128,16 +128,14 @@ func (_c *MockTag_GetArrayInfo_Call) RunAndReturn(run func() []model.ArrayInfo)
}
// GetDataTypeSize provides a mock function with given fields:
-func (_m *MockTag) GetDataTypeSize() *readwritemodel.SimulatedDataTypeSizes {
+func (_m *MockTag) GetDataTypeSize() readwritemodel.SimulatedDataTypeSizes {
ret := _m.Called()
- var r0 *readwritemodel.SimulatedDataTypeSizes
- if rf, ok := ret.Get(0).(func() *readwritemodel.SimulatedDataTypeSizes); ok {
+ var r0 readwritemodel.SimulatedDataTypeSizes
+ if rf, ok := ret.Get(0).(func() readwritemodel.SimulatedDataTypeSizes); ok {
r0 = rf()
} else {
- if ret.Get(0) != nil {
- r0 = ret.Get(0).(*readwritemodel.SimulatedDataTypeSizes)
- }
+ r0 = ret.Get(0).(readwritemodel.SimulatedDataTypeSizes)
}
return r0
@@ -160,12 +158,12 @@ func (_c *MockTag_GetDataTypeSize_Call) Run(run func()) *MockTag_GetDataTypeSize
return _c
}
-func (_c *MockTag_GetDataTypeSize_Call) Return(_a0 *readwritemodel.SimulatedDataTypeSizes) *MockTag_GetDataTypeSize_Call {
+func (_c *MockTag_GetDataTypeSize_Call) Return(_a0 readwritemodel.SimulatedDataTypeSizes) *MockTag_GetDataTypeSize_Call {
_c.Call.Return(_a0)
return _c
}
-func (_c *MockTag_GetDataTypeSize_Call) RunAndReturn(run func() *readwritemodel.SimulatedDataTypeSizes) *MockTag_GetDataTypeSize_Call {
+func (_c *MockTag_GetDataTypeSize_Call) RunAndReturn(run func() readwritemodel.SimulatedDataTypeSizes) *MockTag_GetDataTypeSize_Call {
_c.Call.Return(run)
return _c
}
@@ -212,16 +210,14 @@ func (_c *MockTag_GetName_Call) RunAndReturn(run func() string) *MockTag_GetName
}
// GetTagType provides a mock function with given fields:
-func (_m *MockTag) GetTagType() *TagType {
+func (_m *MockTag) GetTagType() TagType {
ret := _m.Called()
- var r0 *TagType
- if rf, ok := ret.Get(0).(func() *TagType); ok {
+ var r0 TagType
+ if rf, ok := ret.Get(0).(func() TagType); ok {
r0 = rf()
} else {
- if ret.Get(0) != nil {
- r0 = ret.Get(0).(*TagType)
- }
+ r0 = ret.Get(0).(TagType)
}
return r0
@@ -244,12 +240,12 @@ func (_c *MockTag_GetTagType_Call) Run(run func()) *MockTag_GetTagType_Call {
return _c
}
-func (_c *MockTag_GetTagType_Call) Return(_a0 *TagType) *MockTag_GetTagType_Call {
+func (_c *MockTag_GetTagType_Call) Return(_a0 TagType) *MockTag_GetTagType_Call {
_c.Call.Return(_a0)
return _c
}
-func (_c *MockTag_GetTagType_Call) RunAndReturn(run func() *TagType) *MockTag_GetTagType_Call {
+func (_c *MockTag_GetTagType_Call) RunAndReturn(run func() TagType) *MockTag_GetTagType_Call {
_c.Call.Return(run)
return _c
}
diff --git a/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go b/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
index b7e742bd75..8ee2fd6d7d 100644
--- a/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
+++ b/plc4go/protocols/cbus/readwrite/model/StaticHelper_test.go
@@ -35,12 +35,26 @@ func TestCalculateChecksum(t *testing.T) {
tests := []struct {
name string
args args
+ setup func(t *testing.T, args *args)
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "check it (not enabled)",
+ },
+ {
+ name: "check it",
+ args: args{
+ writeBuffer: utils.NewWriteBufferByteBased(),
+ message: NewZoneStatus(1),
+ srchk: true,
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
+ if tt.setup != nil {
+ tt.setup(t, &tt.args)
+ }
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)
}
@@ -57,7 +71,12 @@ func TestKnowsAccessControlCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -77,7 +96,13 @@ func TestKnowsAirConditioningCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "yes",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ want: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -97,7 +122,12 @@ func TestKnowsCALCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -117,7 +147,12 @@ func TestKnowsClockAndTimekeepingCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -137,7 +172,12 @@ func TestKnowsEnableControlCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -157,7 +197,12 @@ func TestKnowsErrorReportingCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -177,7 +222,13 @@ func TestKnowsLightingCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "yes",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ want: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -197,7 +248,12 @@ func TestKnowsMeasurementCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -217,7 +273,13 @@ func TestKnowsMediaTransportControlCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "yes",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ want: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -237,7 +299,12 @@ func TestKnowsMeteringCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -257,7 +324,13 @@ func TestKnowsSecurityCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "yes",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ want: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -277,7 +350,12 @@ func TestKnowsTelephonyCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -297,7 +375,12 @@ func TestKnowsTemperatureBroadcastCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "no",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -317,7 +400,13 @@ func TestKnowsTriggerControlCommandTypeContainer(t *testing.T) {
args args
want bool
}{
- // TODO: Add test cases.
+ {
+ name: "yes",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ want: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -340,7 +429,37 @@ func TestReadAndValidateChecksum(t *testing.T) {
want Checksum
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "don't do it",
+ },
+ {
+ name: "do it wrong message",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ message: nil,
+ srchk: true,
+ },
+ wantErr: true,
+ },
+ {
+ name: "do it",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte("00")),
+ message: NewZoneStatus(12),
+ srchk: true,
+ },
+ want: NewChecksum(0),
+ wantErr: false,
+ },
+ {
+ name: "do it wrong checksum",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte("AFFE")),
+ message: NewZoneStatus(12),
+ srchk: true,
+ },
+ wantErr: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -350,7 +469,7 @@ func TestReadAndValidateChecksum(t *testing.T) {
return
}
if !assert.Equal(t, tt.want, got) {
- t.Errorf("ReadAndValidateChecksum() got = %v, want %v", got, tt.want)
+ t.Errorf("ReadAndValidateChecksum() got = \n%v, want \n%v", got, tt.want)
}
})
}
@@ -366,7 +485,20 @@ func TestReadCALData(t *testing.T) {
want CALData
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "failing",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ wantErr: true,
+ },
+ {
+ name: "cal data",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte("2101")),
+ },
+ want: NewCALDataIdentify(Attribute_Type, CALCommandTypeContainer_CALCommandIdentify, nil, nil),
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -394,7 +526,43 @@ func TestReadCBusCommand(t *testing.T) {
want CBusCommand
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "failing",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ wantErr: true,
+ },
+ {
+ name: "cbus command data",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte("46310900A400410600")),
+ },
+ want: NewCBusCommandPointToPoint(
+ NewCBusPointToPointCommandIndirect(
+ NewBridgeAddress(49),
+ NewNetworkRoute(NewNetworkProtocolControlInformation(1, 1), nil),
+ NewUnitAddress(0),
+ 12553,
+ NewCALDataWrite(
+ Parameter_UNKNOWN_01,
+ 65,
+ NewParameterValueRaw([]byte{6, 00}, 2),
+ CALCommandTypeContainer_CALCommandWrite_4Bytes,
+ nil,
+ nil,
+ ),
+ nil,
+ ),
+ NewCBusHeader(
+ PriorityClass_Class3,
+ false,
+ 0,
+ DestinationAddressType_PointToPoint,
+ ),
+ nil,
+ ),
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -404,7 +572,7 @@ func TestReadCBusCommand(t *testing.T) {
return
}
if !assert.Equal(t, tt.want, got) {
- t.Errorf("ReadCBusCommand() got = %v, want %v", got, tt.want)
+ t.Errorf("ReadCBusCommand() got = \n%v, want \n%v", got, tt.want)
}
})
}
@@ -423,7 +591,22 @@ func TestReadEncodedReply(t *testing.T) {
want EncodedReply
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "failing",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ wantErr: true,
+ },
+ {
+ name: "encoded reply",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte("8510020000FF6A")),
+ options: NewCBusOptions(false, false, false, false, false, false, false, false, false),
+ requestContext: NewRequestContext(false),
+ },
+ wantErr: true,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -449,7 +632,13 @@ func TestWriteCALData(t *testing.T) {
args args
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "write something",
+ args: args{
+ writeBuffer: utils.NewWriteBufferBoxBased(),
+ calData: NewCALDataReset(0, nil, nil),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -470,7 +659,13 @@ func TestWriteCBusCommand(t *testing.T) {
args args
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "write something",
+ args: args{
+ writeBuffer: utils.NewWriteBufferBoxBased(),
+ cbusCommand: NewCBusCommandDeviceManagement(0, 0, NewCBusHeader(0, false, 0, 0), nil),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -491,7 +686,27 @@ func TestWriteEncodedReply(t *testing.T) {
args args
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "write something",
+ args: args{
+ writeBuffer: utils.NewWriteBufferBoxBased(),
+ encodedReply: NewEncodedReplyCALReply(
+ NewCALReplyShort(
+ 0,
+ NewCALDataReset(
+ 0,
+ nil,
+ NewRequestContext(false),
+ ),
+ nil,
+ NewRequestContext(false),
+ ),
+ 0,
+ nil,
+ NewRequestContext(false),
+ ),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -512,7 +727,9 @@ func Test_encodeHexUpperCase(t *testing.T) {
args args
want int
}{
- // TODO: Add test cases.
+ {
+ name: "encode nothing",
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -557,7 +774,13 @@ func Test_getChecksum(t *testing.T) {
want byte
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "get it",
+ args: args{
+ message: NewZoneStatus(0),
+ },
+ wantErr: false,
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -585,7 +808,14 @@ func Test_readBytesFromHex(t *testing.T) {
want []byte
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "read it",
+ args: args{
+ readBuffer: utils.NewReadBufferByteBased([]byte{1, 2, 3, 4}),
+ },
+ wantErr: true,
+ },
+ // TODO: add more tests
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -612,7 +842,13 @@ func Test_writeSerializableToHex(t *testing.T) {
args args
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "write it",
+ args: args{
+ writeBuffer: utils.NewWriteBufferBoxBased(),
+ serializable: NewZoneStatus(0),
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@@ -634,7 +870,13 @@ func Test_writeToHex(t *testing.T) {
args args
wantErr bool
}{
- // TODO: Add test cases.
+ {
+ name: "write it",
+ args: args{
+ writeBuffer: utils.NewWriteBufferBoxBased(),
+ bytesToWrite: []byte{1, 2, 3, 4},
+ },
+ },
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {