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/05/30 15:16:22 UTC

[plc4x] branch develop updated (73873d31fd -> 66564c9c84)

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


    from 73873d31fd test(plc4go): exclude *_plc4xgen.go from coverage
     new 1e3c2e139c chore(doc): extend API doc for values
     new b4e1c44892 test(plc4go/spi): add tests for special methods of PlcValue
     new c9db23c018 fix(plc4go/spi): fix WSTRING production
     new 66564c9c84 test(plc4go/spi): add test for PlcValueHandler

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/pkg/api/values/plc_value.go                 |  52 ++
 plc4go/spi/values/PlcDWORD.go                      |  14 +
 plc4go/spi/values/PlcINT.go                        |   2 +-
 plc4go/spi/values/PlcLINT.go                       |   2 +-
 plc4go/spi/values/PlcLREAL.go                      |   2 +-
 plc4go/spi/values/PlcLWORD.go                      |  11 +-
 plc4go/spi/values/PlcSINT.go                       |   2 +-
 plc4go/spi/values/PlcUDINT.go                      |   2 +-
 plc4go/spi/values/PlcUINT.go                       |   2 +-
 plc4go/spi/values/PlcULINT.go                      |   2 +-
 plc4go/spi/values/PlcUSINT.go                      |   2 +-
 plc4go/spi/values/PlcValueAdapter.go               |   6 +-
 plc4go/spi/values/PlcValueAdapter_test.go          | 411 +++++++++
 plc4go/spi/values/PlcValueHandler.go               |   2 +-
 plc4go/spi/values/PlcValueHandler_test.go          | 917 +++++++++++++++++++++
 .../model => spi/values}/mock_ArrayInfo_test.go    |   2 +-
 plc4go/spi/{model => values}/mock_PlcTag_test.go   |  30 +-
 plc4go/spi/{ => values}/mock_requirements.go       |  13 +-
 plc4go/spi/values/value_combination_test.go        | 160 ++++
 19 files changed, 1600 insertions(+), 34 deletions(-)
 create mode 100644 plc4go/spi/values/PlcValueAdapter_test.go
 create mode 100644 plc4go/spi/values/PlcValueHandler_test.go
 copy plc4go/{pkg/api/model => spi/values}/mock_ArrayInfo_test.go (99%)
 copy plc4go/spi/{model => values}/mock_PlcTag_test.go (84%)
 copy plc4go/spi/{ => values}/mock_requirements.go (81%)


[plc4x] 02/04: test(plc4go/spi): add tests for special methods of PlcValue

Posted by sr...@apache.org.
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 b4e1c448926b6d5bdad2395c889f7555077df30b
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue May 30 16:25:40 2023 +0200

    test(plc4go/spi): add tests for special methods of PlcValue
---
 plc4go/spi/values/PlcDWORD.go               |  14 +
 plc4go/spi/values/PlcINT.go                 |   2 +-
 plc4go/spi/values/PlcLINT.go                |   2 +-
 plc4go/spi/values/PlcLREAL.go               |   2 +-
 plc4go/spi/values/PlcLWORD.go               |  11 +-
 plc4go/spi/values/PlcSINT.go                |   2 +-
 plc4go/spi/values/PlcUDINT.go               |   2 +-
 plc4go/spi/values/PlcUINT.go                |   2 +-
 plc4go/spi/values/PlcULINT.go               |   2 +-
 plc4go/spi/values/PlcUSINT.go               |   2 +-
 plc4go/spi/values/PlcValueAdapter.go        |   6 +-
 plc4go/spi/values/PlcValueAdapter_test.go   | 411 ++++++++++++++++++++++++++++
 plc4go/spi/values/value_combination_test.go | 160 +++++++++++
 13 files changed, 605 insertions(+), 13 deletions(-)

diff --git a/plc4go/spi/values/PlcDWORD.go b/plc4go/spi/values/PlcDWORD.go
index 61274beb8e..378b189230 100644
--- a/plc4go/spi/values/PlcDWORD.go
+++ b/plc4go/spi/values/PlcDWORD.go
@@ -158,15 +158,29 @@ func (m PlcDWORD) GetInt32() int32 {
 	return 0
 }
 
+func (m PlcDWORD) IsInt64() bool {
+	return m.value < math.MaxUint32
+}
+
 func (m PlcDWORD) GetInt64() int64 {
 	return int64(m.GetUint32())
 }
 
+func (m PlcDWORD) IsFloat32() bool {
+	//TODO: Check if this is ok
+	return true
+}
+
 func (m PlcDWORD) GetFloat32() float32 {
 	//TODO: Check if this is ok
 	return float32(m.GetUint32())
 }
 
+func (m PlcDWORD) IsFloat64() bool {
+	//TODO: Check if this is ok
+	return true
+}
+
 func (m PlcDWORD) GetFloat64() float64 {
 	//TODO: Check if this is ok
 	return float64(m.GetUint32())
diff --git a/plc4go/spi/values/PlcINT.go b/plc4go/spi/values/PlcINT.go
index 15c196250c..c35ee2a8ce 100644
--- a/plc4go/spi/values/PlcINT.go
+++ b/plc4go/spi/values/PlcINT.go
@@ -50,7 +50,7 @@ func (m PlcINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcINT) GetBoolean() bool {
+func (m PlcINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcLINT.go b/plc4go/spi/values/PlcLINT.go
index 6aeb24742c..3a71e04dc0 100644
--- a/plc4go/spi/values/PlcLINT.go
+++ b/plc4go/spi/values/PlcLINT.go
@@ -50,7 +50,7 @@ func (m PlcLINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcLINT) GetBoolean() bool {
+func (m PlcLINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcLREAL.go b/plc4go/spi/values/PlcLREAL.go
index 0a5829c594..ec974aabfe 100644
--- a/plc4go/spi/values/PlcLREAL.go
+++ b/plc4go/spi/values/PlcLREAL.go
@@ -49,7 +49,7 @@ func (m PlcLREAL) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcLREAL) GetBoolean() bool {
+func (m PlcLREAL) GetBool() bool {
 	if m.value == 0.0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcLWORD.go b/plc4go/spi/values/PlcLWORD.go
index a7b69b7335..24f76a43c7 100644
--- a/plc4go/spi/values/PlcLWORD.go
+++ b/plc4go/spi/values/PlcLWORD.go
@@ -192,14 +192,21 @@ func (m PlcLWORD) GetInt64() int64 {
 	return 0
 }
 
+func (m PlcLWORD) IsFloat32() bool {
+	return m.IsUint32()
+}
+
 func (m PlcLWORD) GetFloat32() float32 {
 	//TODO: Check if this is ok
-	return float32(m.GetUint32())
+	return float32(m.value)
+}
+func (m PlcLWORD) IsFloat64() bool {
+	return true
 }
 
 func (m PlcLWORD) GetFloat64() float64 {
 	//TODO: Check if this is ok
-	return float64(m.GetUint32())
+	return float64(m.value)
 }
 
 func (m PlcLWORD) IsString() bool {
diff --git a/plc4go/spi/values/PlcSINT.go b/plc4go/spi/values/PlcSINT.go
index 2ff6750c2f..32e2ebea4e 100644
--- a/plc4go/spi/values/PlcSINT.go
+++ b/plc4go/spi/values/PlcSINT.go
@@ -49,7 +49,7 @@ func (m PlcSINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcSINT) GetBoolean() bool {
+func (m PlcSINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcUDINT.go b/plc4go/spi/values/PlcUDINT.go
index dc47773e4d..6c7581ae4c 100644
--- a/plc4go/spi/values/PlcUDINT.go
+++ b/plc4go/spi/values/PlcUDINT.go
@@ -50,7 +50,7 @@ func (m PlcUDINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcUDINT) GetBoolean() bool {
+func (m PlcUDINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcUINT.go b/plc4go/spi/values/PlcUINT.go
index 8fb035d76d..d42dc7f50e 100644
--- a/plc4go/spi/values/PlcUINT.go
+++ b/plc4go/spi/values/PlcUINT.go
@@ -50,7 +50,7 @@ func (m PlcUINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcUINT) GetBoolean() bool {
+func (m PlcUINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcULINT.go b/plc4go/spi/values/PlcULINT.go
index 5e281c7696..97a1cee62e 100644
--- a/plc4go/spi/values/PlcULINT.go
+++ b/plc4go/spi/values/PlcULINT.go
@@ -50,7 +50,7 @@ func (m PlcULINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcULINT) GetBoolean() bool {
+func (m PlcULINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcUSINT.go b/plc4go/spi/values/PlcUSINT.go
index abad6115f5..6432bca48d 100644
--- a/plc4go/spi/values/PlcUSINT.go
+++ b/plc4go/spi/values/PlcUSINT.go
@@ -50,7 +50,7 @@ func (m PlcUSINT) GetRaw() []byte {
 	return theBytes
 }
 
-func (m PlcUSINT) GetBoolean() bool {
+func (m PlcUSINT) GetBool() bool {
 	if m.value == 0 {
 		return false
 	}
diff --git a/plc4go/spi/values/PlcValueAdapter.go b/plc4go/spi/values/PlcValueAdapter.go
index e51ef3bd65..173869cf2e 100644
--- a/plc4go/spi/values/PlcValueAdapter.go
+++ b/plc4go/spi/values/PlcValueAdapter.go
@@ -204,8 +204,8 @@ func (m PlcValueAdapter) IsList() bool {
 func (m PlcValueAdapter) GetLength() uint32 {
 	panic("GetLength not implemented")
 }
-func (m PlcValueAdapter) GetIndex(i uint32) apiValues.PlcValue {
-	return nil
+func (m PlcValueAdapter) GetIndex(_ uint32) apiValues.PlcValue {
+	panic("GetIndex not Implemented")
 }
 func (m PlcValueAdapter) GetList() []apiValues.PlcValue {
 	panic("GetList not implemented")
@@ -223,7 +223,7 @@ func (m PlcValueAdapter) GetKeys() []string {
 	panic("GetKeys not implemented")
 }
 func (m PlcValueAdapter) HasKey(_ string) bool {
-	return false
+	panic("HasKey not implemented")
 }
 func (m PlcValueAdapter) GetValue(_ string) apiValues.PlcValue {
 	panic("GetValue not implemented")
diff --git a/plc4go/spi/values/PlcValueAdapter_test.go b/plc4go/spi/values/PlcValueAdapter_test.go
new file mode 100644
index 0000000000..21797cfc4b
--- /dev/null
+++ b/plc4go/spi/values/PlcValueAdapter_test.go
@@ -0,0 +1,411 @@
+/*
+ * 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 values
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func TestPlcSimpleNumericValueAdapter_IsBool(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsBool())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsByte(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsByte())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsFloat32(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsFloat32())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsFloat64(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsFloat64())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsInt16(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt16())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsInt32(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt32())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsInt64(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt64())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsInt8(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt8())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsString(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsString())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsUint16(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint16())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsUint32(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint32())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsUint64(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint64())
+}
+
+func TestPlcSimpleNumericValueAdapter_IsUint8(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint8())
+}
+
+func TestPlcSimpleNumericValueAdapter_String(t *testing.T) {
+	assert.Equal(t, "not implemented", PlcSimpleNumericValueAdapter{}.String())
+}
+
+func TestPlcSimpleValueAdapter_GetLength(t *testing.T) {
+	assert.Equal(t, uint32(1), PlcSimpleNumericValueAdapter{}.GetLength())
+}
+
+func TestPlcSimpleValueAdapter_IsSimple(t *testing.T) {
+	assert.True(t, PlcSimpleNumericValueAdapter{}.IsSimple())
+}
+
+func TestPlcSimpleValueAdapter_String(t *testing.T) {
+	assert.Equal(t, "not implemented", PlcSimpleValueAdapter{}.String())
+}
+
+func TestPlcValueAdapter_GetBool(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.GetBool())
+}
+
+func TestPlcValueAdapter_GetBoolArray(t *testing.T) {
+	assert.Nil(t, PlcValueAdapter{}.GetBoolArray())
+}
+
+func TestPlcValueAdapter_GetBoolAt(t *testing.T) {
+	t.Run("index 0", func(t *testing.T) {
+		assert.False(t, PlcValueAdapter{}.GetBoolAt(0))
+	})
+	t.Run("index 1", func(t *testing.T) {
+		assert.False(t, PlcValueAdapter{}.GetBoolAt(1))
+	})
+}
+
+func TestPlcValueAdapter_GetBoolLength(t *testing.T) {
+	assert.Equal(t, uint32(1), PlcValueAdapter{}.GetBoolLength())
+}
+
+func TestPlcValueAdapter_GetByte(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetByte()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetDate(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetDate()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetDateTime(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetDateTime()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetDuration(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetDuration()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetFloat32(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetFloat32()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetFloat64(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetFloat64()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetIndex(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetIndex(0)
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetInt16(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetInt16()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetInt32(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetInt32()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetInt64(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetInt64()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetInt8(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetInt8()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetKeys(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetKeys()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetLength(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetLength()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetList(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetList()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetPlcValueType(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetPlcValueType()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetRaw(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetRaw()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetString(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetString()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetStruct(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetStruct()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetTime(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetTime()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetUint16(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetUint16()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetUint32(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetUint32()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetUint64(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetUint64()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetUint8(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetUint8()
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_GetValue(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.GetValue("")
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_HasKey(t *testing.T) {
+	defer func() {
+		recover()
+	}()
+	PlcValueAdapter{}.HasKey("")
+	t.Error("above should panic")
+}
+
+func TestPlcValueAdapter_IsBool(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsBool())
+}
+
+func TestPlcValueAdapter_IsByte(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsByte())
+}
+
+func TestPlcValueAdapter_IsDate(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsDate())
+}
+
+func TestPlcValueAdapter_IsDateTime(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsDateTime())
+}
+
+func TestPlcValueAdapter_IsDuration(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsDuration())
+}
+
+func TestPlcValueAdapter_IsFloat32(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsFloat32())
+}
+
+func TestPlcValueAdapter_IsFloat64(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsFloat64())
+}
+
+func TestPlcValueAdapter_IsInt16(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt16())
+}
+
+func TestPlcValueAdapter_IsInt32(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt32())
+}
+
+func TestPlcValueAdapter_IsInt64(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt64())
+}
+
+func TestPlcValueAdapter_IsInt8(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsInt8())
+}
+
+func TestPlcValueAdapter_IsList(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsList())
+}
+
+func TestPlcValueAdapter_IsNull(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsNull())
+}
+
+func TestPlcValueAdapter_IsNullable(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsNullable())
+}
+
+func TestPlcValueAdapter_IsRaw(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsRaw())
+}
+
+func TestPlcValueAdapter_IsSimple(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsSimple())
+}
+
+func TestPlcValueAdapter_IsString(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsString())
+}
+
+func TestPlcValueAdapter_IsStruct(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsStruct())
+}
+
+func TestPlcValueAdapter_IsTime(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsTime())
+}
+
+func TestPlcValueAdapter_IsUint16(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint16())
+}
+
+func TestPlcValueAdapter_IsUint32(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint32())
+}
+
+func TestPlcValueAdapter_IsUint64(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint64())
+}
+
+func TestPlcValueAdapter_IsUint8(t *testing.T) {
+	assert.False(t, PlcValueAdapter{}.IsUint8())
+}
+
+func TestPlcValueAdapter_String(t *testing.T) {
+	assert.Equal(t, "not implemented", PlcValueAdapter{}.String())
+}
diff --git a/plc4go/spi/values/value_combination_test.go b/plc4go/spi/values/value_combination_test.go
index 9cb7e74db8..0a69d0a159 100644
--- a/plc4go/spi/values/value_combination_test.go
+++ b/plc4go/spi/values/value_combination_test.go
@@ -505,3 +505,163 @@ func TestCombinations(t *testing.T) {
 		})
 	}
 }
+
+func TestExtraTests(t *testing.T) {
+	// These tests are for extra methods not covered by TestCombinations
+	t.Run("PLCDate", func(t *testing.T) {
+		t.Run("constructors", func(t *testing.T) {
+			t.Run("uint16", func(t *testing.T) {
+				assert.NotNil(t, NewPlcDATE(uint16(1)))
+			})
+			t.Run("uint32", func(t *testing.T) {
+				assert.NotNil(t, NewPlcDATE(uint32(1)))
+			})
+			t.Run("FromSecondsSinceEpoch", func(t *testing.T) {
+				assert.NotNil(t, NewPlcDATEFromSecondsSinceEpoch(1))
+			})
+			t.Run("FromDaysSinceEpoch", func(t *testing.T) {
+				assert.NotNil(t, NewPlcDATEFromDaysSinceEpoch(1))
+			})
+			t.Run("FromDaysSinceSiemensEpoch", func(t *testing.T) {
+				assert.NotNil(t, NewPlcDATEFromDaysSinceSiemensEpoch(1))
+			})
+		})
+		t.Run("GetSecondsSinceEpoch", func(t *testing.T) {
+			NewPlcDATE(time.Now()).GetSecondsSinceEpoch()
+		})
+		t.Run("GetDaysSinceEpoch", func(t *testing.T) {
+			NewPlcDATE(time.Now()).GetDaysSinceEpoch()
+		})
+		t.Run("GetDaysSinceSiemensEpoch", func(t *testing.T) {
+			NewPlcDATE(time.Now()).GetDaysSinceSiemensEpoch()
+		})
+	})
+	t.Run("PlcLDATE_AND_TIME", func(t *testing.T) {
+		t.Run("constructors", func(t *testing.T) {
+			t.Run("uint16", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLDATE_AND_TIME(uint16(1)))
+			})
+			t.Run("uint32", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLDATE_AND_TIME(uint32(1)))
+			})
+			t.Run("FromNanosecondsSinceEpoch", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLDATE_AND_TIMEFromNanosecondsSinceEpoch(1))
+			})
+		})
+		t.Run("GetNanosecondsSinceEpoch", func(t *testing.T) {
+			NewPlcLDATE_AND_TIME(time.Now()).GetNanosecondsSinceEpoch()
+		})
+	})
+	t.Run("PlcLDATE", func(t *testing.T) {
+		t.Run("constructors", func(t *testing.T) {
+			t.Run("uint16", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLDATE(uint16(1)))
+			})
+			t.Run("uint64", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLDATE(uint64(1)))
+			})
+			t.Run("FromNanosecondsSinceEpoch", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLDATEFromNanosecondsSinceEpoch(1))
+			})
+		})
+		t.Run("GetNanosecondsSinceEpoch", func(t *testing.T) {
+			NewPlcLDATE(time.Now()).GetNanosecondsSinceEpoch()
+		})
+	})
+	t.Run("PlcList", func(t *testing.T) {
+		t.Run("GetLength", func(t *testing.T) {
+			NewPlcList([]apiValues.PlcValue{NewPlcNULL()}).GetLength()
+		})
+		t.Run("GetIndex", func(t *testing.T) {
+			NewPlcList([]apiValues.PlcValue{NewPlcNULL()}).GetIndex(0)
+		})
+		t.Run("GetKeys", func(t *testing.T) {
+			NewPlcList([]apiValues.PlcValue{NewPlcStruct(map[string]apiValues.PlcValue{})}).GetKeys()
+		})
+		t.Run("HasKey", func(t *testing.T) {
+			NewPlcList([]apiValues.PlcValue{NewPlcStruct(map[string]apiValues.PlcValue{})}).HasKey("")
+		})
+		t.Run("GetValue", func(t *testing.T) {
+			NewPlcList([]apiValues.PlcValue{NewPlcStruct(map[string]apiValues.PlcValue{})}).GetValue("")
+		})
+	})
+	t.Run("PlcLTIME", func(t *testing.T) {
+		t.Run("FromNanoseconds", func(t *testing.T) {
+			assert.NotNil(t, NewPlcLTIMEFromNanoseconds(0))
+		})
+		t.Run("GetNanoseconds", func(t *testing.T) {
+			NewPlcLTIMEFromNanoseconds(0).GetNanoseconds()
+		})
+	})
+	t.Run("PlcLTIME_OF_DAY", func(t *testing.T) {
+		t.Run("constructors", func(t *testing.T) {
+			t.Run("uint16", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLTIME_OF_DAY(uint16(1)))
+			})
+			t.Run("uint64", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLTIME_OF_DAY(uint64(1)))
+			})
+			t.Run("FromNanosecondsSinceMidnight", func(t *testing.T) {
+				assert.NotNil(t, NewPlcLTIME_OF_DAYFromNanosecondsSinceMidnight(1))
+			})
+		})
+		t.Run("GetNanosecondsSinceEpoch", func(t *testing.T) {
+			NewPlcLTIME_OF_DAY(time.Now()).GetNanosecondsSinceMidnight()
+		})
+	})
+	t.Run("PlcRawByteArray", func(t *testing.T) {
+		t.Run("GetLength", func(t *testing.T) {
+			NewPlcRawByteArray([]byte{1, 2, 3, 4}).GetLength()
+		})
+		t.Run("GetIndex", func(t *testing.T) {
+			NewPlcRawByteArray([]byte{1, 2, 3, 4}).GetIndex(0)
+		})
+	})
+	t.Run("PlcStruct", func(t *testing.T) {
+		t.Run("GetKeys", func(t *testing.T) {
+			NewPlcStruct(map[string]apiValues.PlcValue{
+				"a": NewPlcNULL(),
+				"b": NewPlcNULL(),
+				"c": NewPlcNULL(),
+			}).GetKeys()
+		})
+		t.Run("HasKey", func(t *testing.T) {
+			NewPlcStruct(map[string]apiValues.PlcValue{
+				"a": NewPlcNULL(),
+				"b": NewPlcNULL(),
+				"c": NewPlcNULL(),
+			}).HasKey("a")
+		})
+		t.Run("GetValue", func(t *testing.T) {
+			NewPlcStruct(map[string]apiValues.PlcValue{
+				"a": NewPlcNULL(),
+				"b": NewPlcNULL(),
+				"c": NewPlcNULL(),
+			}).GetValue("a")
+		})
+	})
+	t.Run("PlcTIME", func(t *testing.T) {
+		t.Run("FromMilliseconds", func(t *testing.T) {
+			assert.NotNil(t, NewPlcTIMEFromMilliseconds(1))
+		})
+		t.Run("GetMilliseconds", func(t *testing.T) {
+			NewPlcTIMEFromMilliseconds(1).GetMilliseconds()
+		})
+	})
+	t.Run("PlcTIME_OF_DAY", func(t *testing.T) {
+		t.Run("constructors", func(t *testing.T) {
+			t.Run("uint16", func(t *testing.T) {
+				assert.NotNil(t, NewPlcTIME_OF_DAY(uint16(1)))
+			})
+			t.Run("uint32", func(t *testing.T) {
+				assert.NotNil(t, NewPlcTIME_OF_DAY(uint32(1)))
+			})
+			t.Run("FromMillisecondsSinceMidnight(", func(t *testing.T) {
+				assert.NotNil(t, NewPlcTIME_OF_DAYFromMillisecondsSinceMidnight(1))
+			})
+		})
+		t.Run("GetMillisecondsSinceMidnight", func(t *testing.T) {
+			NewPlcTIME_OF_DAY(time.Now()).GetMillisecondsSinceMidnight()
+		})
+	})
+}


[plc4x] 01/04: chore(doc): extend API doc for values

Posted by sr...@apache.org.
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 1e3c2e139cbbad054ee3ff5c067b1ff1d449b20f
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue May 30 16:25:05 2023 +0200

    chore(doc): extend API doc for values
---
 plc4go/pkg/api/values/plc_value.go | 52 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/plc4go/pkg/api/values/plc_value.go b/plc4go/pkg/api/values/plc_value.go
index 4755ff0af9..614aa68aaa 100644
--- a/plc4go/pkg/api/values/plc_value.go
+++ b/plc4go/pkg/api/values/plc_value.go
@@ -30,8 +30,11 @@ type PlcValue interface {
 	////
 	// Simple Types
 
+	// IsSimple tells if this value is a simple datatype
 	IsSimple() bool
+	// IsNullable tells if this value is nullable
 	IsNullable() bool
+	// IsNull tells if this value is null
 	IsNull() bool
 	//
 	///
@@ -39,10 +42,15 @@ type PlcValue interface {
 	////
 	// Boolean
 
+	// IsBool tells if this value is a bool
 	IsBool() bool
+	// GetBoolLength return the bool length. Attention: Before using check with IsBool otherwise it might panic.
 	GetBoolLength() uint32
+	// GetBool return the bool. Attention: Before using check with IsBool otherwise it might panic.
 	GetBool() bool
+	// GetBoolAt return the bool at specified index. Attention: Before using check with IsBool otherwise it might panic.
 	GetBoolAt(index uint32) bool
+	// GetBoolArray return an array of bool. Attention: Before using check with IsBool otherwise it might panic.
 	GetBoolArray() []bool
 	//
 	///
@@ -50,7 +58,9 @@ type PlcValue interface {
 	////
 	// Byte
 
+	// IsByte tells if this is a byte
 	IsByte() bool
+	// GetByte return the byte length. Attention: Before using check with IsByte otherwise it might panic.
 	GetByte() byte
 	//
 	///
@@ -58,21 +68,37 @@ type PlcValue interface {
 	////
 	// Integer
 
+	// IsUint8 tells if this is an uint8
 	IsUint8() bool
+	// GetUint8 return the uint8. Attention: Before using check with IsUint8 otherwise it might panic.
 	GetUint8() uint8
+	// IsUint16 tells if this is an uint16
 	IsUint16() bool
+	// GetUint16 return the uint16. Attention: Before using check with IsUint16 otherwise it might panic.
 	GetUint16() uint16
+	// IsUint32 tells if this is an uint32
 	IsUint32() bool
+	// GetUint32 return the uint32. Attention: Before using check with IsUint32 otherwise it might panic.
 	GetUint32() uint32
+	// IsUint64 tells if this is an uint64
 	IsUint64() bool
+	// GetUint64 return the uint64. Attention: Before using check with IsUint64 otherwise it might panic.
 	GetUint64() uint64
+	// IsInt8 tells if this is an int8
 	IsInt8() bool
+	// GetInt8 return the int8. Attention: Before using check with IsInt8 otherwise it might panic.
 	GetInt8() int8
+	// IsInt16 tells if this is an int16
 	IsInt16() bool
+	// GetInt16 return the int16. Attention: Before using check with IsInt16 otherwise it might panic.
 	GetInt16() int16
+	// IsInt32 tells if this is an int32
 	IsInt32() bool
+	// GetInt32 return the int32. Attention: Before using check with IsInt32 otherwise it might panic.
 	GetInt32() int32
+	// IsInt64 tells if this is an int64
 	IsInt64() bool
+	// GetInt64 return the int64. Attention: Before using check with IsInt64 otherwise it might panic.
 	GetInt64() int64
 	//
 	///
@@ -80,9 +106,13 @@ type PlcValue interface {
 	////
 	// Floating Point
 
+	// IsFloat32 tells if this is a float32
 	IsFloat32() bool
+	// GetFloat32 return the float32. Attention: Before using check with IsFloat32 otherwise it might panic.
 	GetFloat32() float32
+	// IsFloat64 tells if this is a float64
 	IsFloat64() bool
+	// GetFloat64 return the float64. Attention: Before using check with IsFloat64 otherwise it might panic.
 	GetFloat64() float64
 	//
 	///
@@ -90,7 +120,9 @@ type PlcValue interface {
 	////
 	// String
 
+	// IsString tells if this is a string
 	IsString() bool
+	// GetString return the string. Attention: Before using check with IsString otherwise it might panic.
 	GetString() string
 	//
 	///
@@ -98,13 +130,21 @@ type PlcValue interface {
 	////
 	// Time
 
+	// IsTime tells if this is a time.Time
 	IsTime() bool
+	// GetTime return the time.Time. Attention: Before using check with IsTime otherwise it might panic.
 	GetTime() time.Time
+	// IsDuration tells if this is a time.Duration
 	IsDuration() bool
+	// GetDuration return the time.Duration. Attention: Before using check with IsDuration otherwise it might panic.
 	GetDuration() time.Duration
+	// IsDate tells if this is a time.Time
 	IsDate() bool
+	// GetDate return the time.Time. Attention: Before using check with IsDate otherwise it might panic.
 	GetDate() time.Time
+	// IsDateTime tells if this is a time.Time
 	IsDateTime() bool
+	// GetDateTime return the time.Time. Attention: Before using check with IsDateTime otherwise it might panic.
 	GetDateTime() time.Time
 	//
 	///
@@ -112,7 +152,9 @@ type PlcValue interface {
 	////
 	// Raw Access
 
+	// IsRaw tells if this is a raw value
 	IsRaw() bool
+	// GetRaw return the []byte. Attention: Before using check with IsRaw otherwise it might panic.
 	GetRaw() []byte
 	//
 	///
@@ -120,9 +162,13 @@ type PlcValue interface {
 	////
 	// List Methods
 
+	// IsList tells if this is a list
 	IsList() bool
+	// GetLength return the length of list. Attention: Before using check with IsList otherwise it might panic.
 	GetLength() uint32
+	// GetIndex return the element at index or nil if not found. Attention: Before using check with IsList otherwise it might panic.
 	GetIndex(i uint32) PlcValue
+	// GetList return the list. Attention: Before using check with IsList otherwise it might panic.
 	GetList() []PlcValue
 	//
 	///
@@ -130,14 +176,20 @@ type PlcValue interface {
 	////
 	// Struct Methods
 
+	// IsStruct tells if this is a struct (map)
 	IsStruct() bool
+	// GetKeys return the keys of the struct. Attention: Before using check with IsStruct otherwise it might panic.
 	GetKeys() []string
+	// HasKey returns true if it has the key. Attention: Before using check with IsStruct otherwise it might panic.
 	HasKey(key string) bool
+	// GetValue return the value of the struct or nil if not found. Attention: Before using check with IsStruct otherwise it might panic.
 	GetValue(key string) PlcValue
+	// GetStruct return the struct map. Attention: Before using check with IsStruct otherwise it might panic.
 	GetStruct() map[string]PlcValue
 	//
 	///
 
+	// GetPlcValueType returns the PlcValueType
 	GetPlcValueType() PlcValueType
 }
 


[plc4x] 04/04: test(plc4go/spi): add test for PlcValueHandler

Posted by sr...@apache.org.
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 66564c9c84207b2c665ca4938cb43aaa9effba15
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue May 30 17:16:13 2023 +0200

    test(plc4go/spi): add test for PlcValueHandler
---
 plc4go/spi/values/PlcValueHandler_test.go | 917 ++++++++++++++++++++++++++++++
 plc4go/spi/values/mock_ArrayInfo_test.go  | 175 ++++++
 plc4go/spi/values/mock_PlcTag_test.go     | 182 ++++++
 plc4go/spi/values/mock_requirements.go    |  36 ++
 4 files changed, 1310 insertions(+)

diff --git a/plc4go/spi/values/PlcValueHandler_test.go b/plc4go/spi/values/PlcValueHandler_test.go
new file mode 100644
index 0000000000..7c30f79a50
--- /dev/null
+++ b/plc4go/spi/values/PlcValueHandler_test.go
@@ -0,0 +1,917 @@
+/*
+ * 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 values
+
+import (
+	"fmt"
+	"testing"
+	"time"
+
+	apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
+	apiValues "github.com/apache/plc4x/plc4go/pkg/api/values"
+	"github.com/stretchr/testify/assert"
+)
+
+func TestDefaultValueHandler_NewPlcValue(t *testing.T) {
+	type args struct {
+		tag   apiModel.PlcTag
+		value any
+	}
+	tests := []struct {
+		name      string
+		args      args
+		mockSetup func(t *testing.T, args *args)
+		want      apiValues.PlcValue
+		wantErr   assert.ErrorAssertionFunc
+	}{
+		{
+			name: "simple bool",
+			args: args{
+				value: true,
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				tag := NewMockPlcTag(t)
+				expect := tag.EXPECT()
+				expect.GetArrayInfo().Return(nil)
+				expect.GetValueType().Return(apiValues.BOOL)
+				args.tag = tag
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if tt.mockSetup != nil {
+				tt.mockSetup(t, &tt.args)
+			}
+			m := DefaultValueHandler{}
+			got, err := m.NewPlcValue(tt.args.tag, tt.args.value)
+			if !tt.wantErr(t, err, fmt.Sprintf("NewPlcValue(%v, %v)", tt.args.tag, tt.args.value)) {
+				return
+			}
+			assert.Equalf(t, tt.want, got, "NewPlcValue(%v, %v)", tt.args.tag, tt.args.value)
+		})
+	}
+}
+
+func TestDefaultValueHandler_NewPlcValueFromType(t *testing.T) {
+	type args struct {
+		valueType apiValues.PlcValueType
+		value     any
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    apiValues.PlcValue
+		wantErr assert.ErrorAssertionFunc
+	}{
+		{
+			name:    "null in, error out",
+			wantErr: assert.Error,
+		},
+		{
+			name: "value in, value out",
+			args: args{
+				value: NewPlcBOOL(true),
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "bool string",
+			args: args{
+				valueType: apiValues.BOOL,
+				value:     "true",
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "bool",
+			args: args{
+				valueType: apiValues.BOOL,
+				value:     true,
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "bool wrong",
+			args: args{
+				valueType: apiValues.BOOL,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "byte string",
+			args: args{
+				valueType: apiValues.BYTE,
+				value:     "1",
+			},
+			want:    NewPlcBYTE(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "byte",
+			args: args{
+				valueType: apiValues.BYTE,
+				value:     uint8(1),
+			},
+			want:    NewPlcBYTE(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "byte wrong",
+			args: args{
+				valueType: apiValues.BYTE,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "word string",
+			args: args{
+				valueType: apiValues.WORD,
+				value:     "1",
+			},
+			want:    NewPlcWORD(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "word",
+			args: args{
+				valueType: apiValues.WORD,
+				value:     uint16(1),
+			},
+			want:    NewPlcWORD(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "word wrong",
+			args: args{
+				valueType: apiValues.WORD,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "dword string",
+			args: args{
+				valueType: apiValues.DWORD,
+				value:     "1",
+			},
+			want:    NewPlcDWORD(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "dword",
+			args: args{
+				valueType: apiValues.DWORD,
+				value:     uint32(1),
+			},
+			want:    NewPlcDWORD(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "dword wrong",
+			args: args{
+				valueType: apiValues.DWORD,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "lword string",
+			args: args{
+				valueType: apiValues.LWORD,
+				value:     "1",
+			},
+			want:    NewPlcLWORD(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "lword",
+			args: args{
+				valueType: apiValues.LWORD,
+				value:     uint64(1),
+			},
+			want:    NewPlcLWORD(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "lword wrong",
+			args: args{
+				valueType: apiValues.LWORD,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "usint string",
+			args: args{
+				valueType: apiValues.USINT,
+				value:     "1",
+			},
+			want:    NewPlcUSINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "usint",
+			args: args{
+				valueType: apiValues.USINT,
+				value:     uint8(1),
+			},
+			want:    NewPlcUSINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "usint wrong",
+			args: args{
+				valueType: apiValues.USINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "uint string",
+			args: args{
+				valueType: apiValues.UINT,
+				value:     "1",
+			},
+			want:    NewPlcUINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "uint",
+			args: args{
+				valueType: apiValues.UINT,
+				value:     uint16(1),
+			},
+			want:    NewPlcUINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "uint wrong",
+			args: args{
+				valueType: apiValues.UINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "udint string",
+			args: args{
+				valueType: apiValues.UDINT,
+				value:     "1",
+			},
+			want:    NewPlcUDINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "udint",
+			args: args{
+				valueType: apiValues.UDINT,
+				value:     uint32(1),
+			},
+			want:    NewPlcUDINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "udint wrong",
+			args: args{
+				valueType: apiValues.UDINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "ulint string",
+			args: args{
+				valueType: apiValues.ULINT,
+				value:     "1",
+			},
+			want:    NewPlcULINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "ulint",
+			args: args{
+				valueType: apiValues.ULINT,
+				value:     uint64(1),
+			},
+			want:    NewPlcULINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "ulint wrong",
+			args: args{
+				valueType: apiValues.ULINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "sint string",
+			args: args{
+				valueType: apiValues.SINT,
+				value:     "1",
+			},
+			want:    NewPlcSINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "sint",
+			args: args{
+				valueType: apiValues.SINT,
+				value:     int8(1),
+			},
+			want:    NewPlcSINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "sint wrong",
+			args: args{
+				valueType: apiValues.SINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "int string",
+			args: args{
+				valueType: apiValues.INT,
+				value:     "1",
+			},
+			want:    NewPlcINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "int",
+			args: args{
+				valueType: apiValues.INT,
+				value:     int16(1),
+			},
+			want:    NewPlcINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "int wrong",
+			args: args{
+				valueType: apiValues.INT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "dint string",
+			args: args{
+				valueType: apiValues.DINT,
+				value:     "1",
+			},
+			want:    NewPlcDINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "dint",
+			args: args{
+				valueType: apiValues.DINT,
+				value:     int32(1),
+			},
+			want:    NewPlcDINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "dint wrong",
+			args: args{
+				valueType: apiValues.DINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "lint string",
+			args: args{
+				valueType: apiValues.LINT,
+				value:     "1",
+			},
+			want:    NewPlcLINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "lint",
+			args: args{
+				valueType: apiValues.LINT,
+				value:     int64(1),
+			},
+			want:    NewPlcLINT(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "lint wrong",
+			args: args{
+				valueType: apiValues.LINT,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "real string",
+			args: args{
+				valueType: apiValues.REAL,
+				value:     "1",
+			},
+			want:    NewPlcREAL(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "real",
+			args: args{
+				valueType: apiValues.REAL,
+				value:     float32(1),
+			},
+			want:    NewPlcREAL(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "real wrong",
+			args: args{
+				valueType: apiValues.REAL,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "lreal string",
+			args: args{
+				valueType: apiValues.LREAL,
+				value:     "1",
+			},
+			want:    NewPlcLREAL(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "lreal",
+			args: args{
+				valueType: apiValues.LREAL,
+				value:     float64(1),
+			},
+			want:    NewPlcLREAL(1),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "lreal wrong",
+			args: args{
+				valueType: apiValues.LREAL,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "time string",
+			args: args{
+				valueType: apiValues.TIME,
+				value:     "1",
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "time",
+			args: args{
+				valueType: apiValues.TIME,
+				value:     time.Duration(0),
+			},
+			want:    NewPlcTIME(time.Duration(0)),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "time wrong",
+			args: args{
+				valueType: apiValues.TIME,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "date string",
+			args: args{
+				valueType: apiValues.DATE,
+				value:     "1",
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "date",
+			args: args{
+				valueType: apiValues.DATE,
+				value:     time.Time{},
+			},
+			want:    NewPlcDATE(time.Time{}),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "date wrong",
+			args: args{
+				valueType: apiValues.DATE,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "time of day string",
+			args: args{
+				valueType: apiValues.TIME_OF_DAY,
+				value:     "1",
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "time of day",
+			args: args{
+				valueType: apiValues.TIME_OF_DAY,
+				value:     time.Time{},
+			},
+			want:    NewPlcTIME_OF_DAY(time.Time{}),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "time of day  wrong",
+			args: args{
+				valueType: apiValues.TIME_OF_DAY,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "date and time string",
+			args: args{
+				valueType: apiValues.DATE_AND_TIME,
+				value:     "1",
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "date and time",
+			args: args{
+				valueType: apiValues.DATE_AND_TIME,
+				value:     time.Time{},
+			},
+			want:    NewPlcDATE_AND_TIME(time.Time{}),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "date and time wrong",
+			args: args{
+				valueType: apiValues.DATE_AND_TIME,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "char wrong",
+			args: args{
+				valueType: apiValues.CHAR,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "char too much",
+			args: args{
+				valueType: apiValues.CHAR,
+				value:     "12",
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "char",
+			args: args{
+				valueType: apiValues.CHAR,
+				value:     "1",
+			},
+			want:    NewPlcCHAR("1"),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "wchar wrong",
+			args: args{
+				valueType: apiValues.WCHAR,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "wchar too much",
+			args: args{
+				valueType: apiValues.WCHAR,
+				value:     "12",
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "wchar",
+			args: args{
+				valueType: apiValues.WCHAR,
+				value:     "1",
+			},
+			want:    NewPlcWCHAR("1"),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "string wrong",
+			args: args{
+				valueType: apiValues.STRING,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "string",
+			args: args{
+				valueType: apiValues.STRING,
+				value:     "1",
+			},
+			want:    NewPlcSTRING("1"),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "wstring wrong",
+			args: args{
+				valueType: apiValues.WSTRING,
+				value:     1,
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "wstring",
+			args: args{
+				valueType: apiValues.WSTRING,
+				value:     "1",
+			},
+			want:    NewPlcWSTRING("1"),
+			wantErr: assert.NoError,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			m := DefaultValueHandler{}
+			got, err := m.NewPlcValueFromType(tt.args.valueType, tt.args.value)
+			if !tt.wantErr(t, err, fmt.Sprintf("NewPlcValueFromType(%v, %v)", tt.args.valueType, tt.args.value)) {
+				return
+			}
+			assert.Equalf(t, tt.want, got, "NewPlcValueFromType(%v, %v)", tt.args.valueType, tt.args.value)
+		})
+	}
+}
+
+func TestDefaultValueHandler_ParseListType(t *testing.T) {
+	type args struct {
+		tag       apiModel.PlcTag
+		arrayInfo []apiModel.ArrayInfo
+		value     any
+	}
+	tests := []struct {
+		name      string
+		args      args
+		mockSetup func(t *testing.T, args *args)
+		want      apiValues.PlcValue
+		wantErr   assert.ErrorAssertionFunc
+	}{
+		{
+			name: "No array info",
+			args: args{
+				value: true,
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				tag := NewMockPlcTag(t)
+				tag.EXPECT().GetValueType().Return(apiValues.BOOL)
+				args.tag = tag
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "no array",
+			args: args{
+				value: 1,
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				args.arrayInfo = []apiModel.ArrayInfo{
+					NewMockArrayInfo(t),
+				}
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "bool array wrong size",
+			args: args{
+				value: []bool{true, true},
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				info := NewMockArrayInfo(t)
+				info.EXPECT().GetSize().Return(3)
+				args.arrayInfo = []apiModel.ArrayInfo{
+					info,
+				}
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "bool array",
+			args: args{
+				value: []bool{true, true},
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				{
+					tag := NewMockPlcTag(t)
+					tag.EXPECT().GetValueType().Return(apiValues.BOOL)
+					args.tag = tag
+				}
+				{
+					info := NewMockArrayInfo(t)
+					info.EXPECT().GetSize().Return(2)
+					args.arrayInfo = []apiModel.ArrayInfo{
+						info,
+					}
+				}
+			},
+			want:    NewPlcList([]apiValues.PlcValue{NewPlcBOOL(true), NewPlcBOOL(true)}),
+			wantErr: assert.NoError,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if tt.mockSetup != nil {
+				tt.mockSetup(t, &tt.args)
+			}
+			m := DefaultValueHandler{}
+			got, err := m.ParseListType(tt.args.tag, tt.args.arrayInfo, tt.args.value)
+			if !tt.wantErr(t, err, fmt.Sprintf("ParseListType(%v, %v, %v)", tt.args.tag, tt.args.arrayInfo, tt.args.value)) {
+				return
+			}
+			assert.Equalf(t, tt.want, got, "ParseListType(%v, %v, %v)", tt.args.tag, tt.args.arrayInfo, tt.args.value)
+		})
+	}
+}
+
+func TestDefaultValueHandler_ParseSimpleType(t *testing.T) {
+	type args struct {
+		tag   apiModel.PlcTag
+		value any
+	}
+	tests := []struct {
+		name      string
+		args      args
+		mockSetup func(t *testing.T, args *args)
+		want      apiValues.PlcValue
+		wantErr   assert.ErrorAssertionFunc
+	}{
+		{
+			name: "fallback",
+			args: args{
+				value: 1,
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				tag := NewMockPlcTag(t)
+				tag.EXPECT().GetValueType().Return(apiValues.BOOL)
+				args.tag = tag
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if tt.mockSetup != nil {
+				tt.mockSetup(t, &tt.args)
+			}
+			m := DefaultValueHandler{}
+			got, err := m.ParseSimpleType(tt.args.tag, tt.args.value)
+			if !tt.wantErr(t, err, fmt.Sprintf("ParseSimpleType(%v, %v)", tt.args.tag, tt.args.value)) {
+				return
+			}
+			assert.Equalf(t, tt.want, got, "ParseSimpleType(%v, %v)", tt.args.tag, tt.args.value)
+		})
+	}
+}
+
+func TestDefaultValueHandler_ParseStructType(t *testing.T) {
+	type args struct {
+		in0 apiModel.PlcTag
+		in1 any
+	}
+	tests := []struct {
+		name    string
+		args    args
+		want    apiValues.PlcValue
+		wantErr assert.ErrorAssertionFunc
+	}{
+		{
+			wantErr: assert.Error,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			m := DefaultValueHandler{}
+			got, err := m.ParseStructType(tt.args.in0, tt.args.in1)
+			if !tt.wantErr(t, err, fmt.Sprintf("ParseStructType(%v, %v)", tt.args.in0, tt.args.in1)) {
+				return
+			}
+			assert.Equalf(t, tt.want, got, "ParseStructType(%v, %v)", tt.args.in0, tt.args.in1)
+		})
+	}
+}
+
+func TestDefaultValueHandler_parseType(t *testing.T) {
+	type args struct {
+		tag       apiModel.PlcTag
+		arrayInfo []apiModel.ArrayInfo
+		value     any
+	}
+	tests := []struct {
+		name      string
+		args      args
+		mockSetup func(t *testing.T, args *args)
+		want      apiValues.PlcValue
+		wantErr   assert.ErrorAssertionFunc
+	}{
+		{
+			name: "parse list",
+			args: args{
+				value: []bool{true, true},
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				{
+					tag := NewMockPlcTag(t)
+					tag.EXPECT().GetValueType().Return(apiValues.BOOL)
+					args.tag = tag
+				}
+				{
+					info := NewMockArrayInfo(t)
+					info.EXPECT().GetSize().Return(2)
+					args.arrayInfo = []apiModel.ArrayInfo{
+						info,
+					}
+				}
+			},
+			want:    NewPlcList([]apiValues.PlcValue{NewPlcBOOL(true), NewPlcBOOL(true)}),
+			wantErr: assert.NoError,
+		},
+		{
+			name: "parse struct",
+			args: args{
+				value: true,
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				tag := NewMockPlcTag(t)
+				tag.EXPECT().GetValueType().Return(apiValues.Struct)
+				args.tag = tag
+			},
+			wantErr: assert.Error,
+		},
+		{
+			name: "parse simple",
+			args: args{
+				value: true,
+			},
+			mockSetup: func(t *testing.T, args *args) {
+				tag := NewMockPlcTag(t)
+				tag.EXPECT().GetValueType().Return(apiValues.BOOL)
+				args.tag = tag
+			},
+			want:    NewPlcBOOL(true),
+			wantErr: assert.NoError,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if tt.mockSetup != nil {
+				tt.mockSetup(t, &tt.args)
+			}
+			m := DefaultValueHandler{}
+			got, err := m.parseType(tt.args.tag, tt.args.arrayInfo, tt.args.value)
+			if !tt.wantErr(t, err, fmt.Sprintf("parseType(%v, %v, %v)", tt.args.tag, tt.args.arrayInfo, tt.args.value)) {
+				return
+			}
+			assert.Equalf(t, tt.want, got, "parseType(%v, %v, %v)", tt.args.tag, tt.args.arrayInfo, tt.args.value)
+		})
+	}
+}
diff --git a/plc4go/spi/values/mock_ArrayInfo_test.go b/plc4go/spi/values/mock_ArrayInfo_test.go
new file mode 100644
index 0000000000..8260f0322e
--- /dev/null
+++ b/plc4go/spi/values/mock_ArrayInfo_test.go
@@ -0,0 +1,175 @@
+/*
+ * 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.1. DO NOT EDIT.
+
+package values
+
+import mock "github.com/stretchr/testify/mock"
+
+// MockArrayInfo is an autogenerated mock type for the ArrayInfo type
+type MockArrayInfo struct {
+	mock.Mock
+}
+
+type MockArrayInfo_Expecter struct {
+	mock *mock.Mock
+}
+
+func (_m *MockArrayInfo) EXPECT() *MockArrayInfo_Expecter {
+	return &MockArrayInfo_Expecter{mock: &_m.Mock}
+}
+
+// GetLowerBound provides a mock function with given fields:
+func (_m *MockArrayInfo) GetLowerBound() uint32 {
+	ret := _m.Called()
+
+	var r0 uint32
+	if rf, ok := ret.Get(0).(func() uint32); ok {
+		r0 = rf()
+	} else {
+		r0 = ret.Get(0).(uint32)
+	}
+
+	return r0
+}
+
+// MockArrayInfo_GetLowerBound_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLowerBound'
+type MockArrayInfo_GetLowerBound_Call struct {
+	*mock.Call
+}
+
+// GetLowerBound is a helper method to define mock.On call
+func (_e *MockArrayInfo_Expecter) GetLowerBound() *MockArrayInfo_GetLowerBound_Call {
+	return &MockArrayInfo_GetLowerBound_Call{Call: _e.mock.On("GetLowerBound")}
+}
+
+func (_c *MockArrayInfo_GetLowerBound_Call) Run(run func()) *MockArrayInfo_GetLowerBound_Call {
+	_c.Call.Run(func(args mock.Arguments) {
+		run()
+	})
+	return _c
+}
+
+func (_c *MockArrayInfo_GetLowerBound_Call) Return(_a0 uint32) *MockArrayInfo_GetLowerBound_Call {
+	_c.Call.Return(_a0)
+	return _c
+}
+
+func (_c *MockArrayInfo_GetLowerBound_Call) RunAndReturn(run func() uint32) *MockArrayInfo_GetLowerBound_Call {
+	_c.Call.Return(run)
+	return _c
+}
+
+// GetSize provides a mock function with given fields:
+func (_m *MockArrayInfo) GetSize() uint32 {
+	ret := _m.Called()
+
+	var r0 uint32
+	if rf, ok := ret.Get(0).(func() uint32); ok {
+		r0 = rf()
+	} else {
+		r0 = ret.Get(0).(uint32)
+	}
+
+	return r0
+}
+
+// MockArrayInfo_GetSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSize'
+type MockArrayInfo_GetSize_Call struct {
+	*mock.Call
+}
+
+// GetSize is a helper method to define mock.On call
+func (_e *MockArrayInfo_Expecter) GetSize() *MockArrayInfo_GetSize_Call {
+	return &MockArrayInfo_GetSize_Call{Call: _e.mock.On("GetSize")}
+}
+
+func (_c *MockArrayInfo_GetSize_Call) Run(run func()) *MockArrayInfo_GetSize_Call {
+	_c.Call.Run(func(args mock.Arguments) {
+		run()
+	})
+	return _c
+}
+
+func (_c *MockArrayInfo_GetSize_Call) Return(_a0 uint32) *MockArrayInfo_GetSize_Call {
+	_c.Call.Return(_a0)
+	return _c
+}
+
+func (_c *MockArrayInfo_GetSize_Call) RunAndReturn(run func() uint32) *MockArrayInfo_GetSize_Call {
+	_c.Call.Return(run)
+	return _c
+}
+
+// GetUpperBound provides a mock function with given fields:
+func (_m *MockArrayInfo) GetUpperBound() uint32 {
+	ret := _m.Called()
+
+	var r0 uint32
+	if rf, ok := ret.Get(0).(func() uint32); ok {
+		r0 = rf()
+	} else {
+		r0 = ret.Get(0).(uint32)
+	}
+
+	return r0
+}
+
+// MockArrayInfo_GetUpperBound_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUpperBound'
+type MockArrayInfo_GetUpperBound_Call struct {
+	*mock.Call
+}
+
+// GetUpperBound is a helper method to define mock.On call
+func (_e *MockArrayInfo_Expecter) GetUpperBound() *MockArrayInfo_GetUpperBound_Call {
+	return &MockArrayInfo_GetUpperBound_Call{Call: _e.mock.On("GetUpperBound")}
+}
+
+func (_c *MockArrayInfo_GetUpperBound_Call) Run(run func()) *MockArrayInfo_GetUpperBound_Call {
+	_c.Call.Run(func(args mock.Arguments) {
+		run()
+	})
+	return _c
+}
+
+func (_c *MockArrayInfo_GetUpperBound_Call) Return(_a0 uint32) *MockArrayInfo_GetUpperBound_Call {
+	_c.Call.Return(_a0)
+	return _c
+}
+
+func (_c *MockArrayInfo_GetUpperBound_Call) RunAndReturn(run func() uint32) *MockArrayInfo_GetUpperBound_Call {
+	_c.Call.Return(run)
+	return _c
+}
+
+type mockConstructorTestingTNewMockArrayInfo interface {
+	mock.TestingT
+	Cleanup(func())
+}
+
+// NewMockArrayInfo creates a new instance of MockArrayInfo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
+func NewMockArrayInfo(t mockConstructorTestingTNewMockArrayInfo) *MockArrayInfo {
+	mock := &MockArrayInfo{}
+	mock.Mock.Test(t)
+
+	t.Cleanup(func() { mock.AssertExpectations(t) })
+
+	return mock
+}
diff --git a/plc4go/spi/values/mock_PlcTag_test.go b/plc4go/spi/values/mock_PlcTag_test.go
new file mode 100644
index 0000000000..1e3dc24f53
--- /dev/null
+++ b/plc4go/spi/values/mock_PlcTag_test.go
@@ -0,0 +1,182 @@
+/*
+ * 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.1. DO NOT EDIT.
+
+package values
+
+import (
+	apivalues "github.com/apache/plc4x/plc4go/pkg/api/values"
+	mock "github.com/stretchr/testify/mock"
+
+	model "github.com/apache/plc4x/plc4go/pkg/api/model"
+)
+
+// 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
+}
+
+// GetValueType provides a mock function with given fields:
+func (_m *MockPlcTag) GetValueType() apivalues.PlcValueType {
+	ret := _m.Called()
+
+	var r0 apivalues.PlcValueType
+	if rf, ok := ret.Get(0).(func() apivalues.PlcValueType); ok {
+		r0 = rf()
+	} else {
+		r0 = ret.Get(0).(apivalues.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 apivalues.PlcValueType) *MockPlcTag_GetValueType_Call {
+	_c.Call.Return(_a0)
+	return _c
+}
+
+func (_c *MockPlcTag_GetValueType_Call) RunAndReturn(run func() apivalues.PlcValueType) *MockPlcTag_GetValueType_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/spi/values/mock_requirements.go b/plc4go/spi/values/mock_requirements.go
new file mode 100644
index 0000000000..af16574677
--- /dev/null
+++ b/plc4go/spi/values/mock_requirements.go
@@ -0,0 +1,36 @@
+/*
+ * 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 values
+
+import (
+	apiModel "github.com/apache/plc4x/plc4go/pkg/api/model"
+)
+
+// Note this file is a Helper for mockery to generate use mocks from other package
+
+// Deprecated: don't use it in productive code
+type PlcTag interface {
+	apiModel.PlcTag
+}
+
+// Deprecated: don't use it in productive code
+type ArrayInfo interface {
+	apiModel.ArrayInfo
+}


[plc4x] 03/04: fix(plc4go/spi): fix WSTRING production

Posted by sr...@apache.org.
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 c9db23c018a5cfb48a019be0b52b799bfba9510e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue May 30 16:58:40 2023 +0200

    fix(plc4go/spi): fix WSTRING production
---
 plc4go/spi/values/PlcValueHandler.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4go/spi/values/PlcValueHandler.go b/plc4go/spi/values/PlcValueHandler.go
index 563c318a25..127f01bd1d 100644
--- a/plc4go/spi/values/PlcValueHandler.go
+++ b/plc4go/spi/values/PlcValueHandler.go
@@ -407,7 +407,7 @@ func (m DefaultValueHandler) NewPlcValueFromType(valueType apiValues.PlcValueTyp
 		if !isString {
 			return nil, errors.New("non-string to IEC61131_WSTRING conversion not implemented")
 		} else {
-			return NewPlcSTRING(stringValue), nil
+			return NewPlcWSTRING(stringValue), nil
 		}
 	}