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 10:27:44 UTC
[plc4x] branch develop updated: test(plc4go/spi): add some more test for values
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
The following commit(s) were added to refs/heads/develop by this push:
new 47d8dff63f test(plc4go/spi): add some more test for values
47d8dff63f is described below
commit 47d8dff63fe99046f95e9ec787ddba2e9b4785bd
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue May 30 12:27:37 2023 +0200
test(plc4go/spi): add some more test for values
---
plc4go/spi/values/PlcDINT.go | 4 ++--
plc4go/spi/values/PlcStruct.go | 4 ++++
plc4go/spi/values/value_combination_test.go | 12 ++++++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/plc4go/spi/values/PlcDINT.go b/plc4go/spi/values/PlcDINT.go
index 0a138ae23d..a1a12ce245 100644
--- a/plc4go/spi/values/PlcDINT.go
+++ b/plc4go/spi/values/PlcDINT.go
@@ -46,7 +46,7 @@ func (m PlcDINT) GetRaw() []byte {
return theBytes
}
-func (m PlcDINT) GetBoolean() bool {
+func (m PlcDINT) GetBool() bool {
if m.value == 0 {
return false
}
@@ -161,7 +161,7 @@ func (m PlcDINT) Serialize() ([]byte, error) {
return wb.GetBytes(), nil
}
-func (m PlcDINT) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error {
+func (m PlcDINT) SerializeWithWriteBuffer(_ context.Context, writeBuffer utils.WriteBuffer) error {
return writeBuffer.WriteInt32("PlcDINT", 32, m.value)
}
diff --git a/plc4go/spi/values/PlcStruct.go b/plc4go/spi/values/PlcStruct.go
index 1aab19f376..0f853ae631 100644
--- a/plc4go/spi/values/PlcStruct.go
+++ b/plc4go/spi/values/PlcStruct.go
@@ -71,6 +71,10 @@ func (m PlcStruct) GetStruct() map[string]apiValues.PlcValue {
return m.values
}
+func (m PlcStruct) IsString() bool {
+ return true
+}
+
func (m PlcStruct) GetString() string {
var sb strings.Builder
sb.WriteString("PlcStruct{\n")
diff --git a/plc4go/spi/values/value_combination_test.go b/plc4go/spi/values/value_combination_test.go
index f6b9240315..f0885b2c74 100644
--- a/plc4go/spi/values/value_combination_test.go
+++ b/plc4go/spi/values/value_combination_test.go
@@ -99,6 +99,7 @@ func TestCombinations(t *testing.T) {
name: apiValues.DINT,
arguments: []argument{
NewPlcDINT(math.MinInt32),
+ NewPlcDINT(0),
NewPlcDINT(1),
NewPlcDINT(64),
NewPlcDINT(255),
@@ -268,6 +269,17 @@ func TestCombinations(t *testing.T) {
NewPlcTIME_OF_DAY(math.MaxUint32),
},
},
+ {
+ name: apiValues.LTIME_OF_DAY,
+ arguments: []argument{
+ NewPlcLTIME_OF_DAY(time.Now()),
+ NewPlcLTIME_OF_DAY(0),
+ NewPlcLTIME_OF_DAY(1),
+ NewPlcLTIME_OF_DAY(64),
+ NewPlcLTIME_OF_DAY(255),
+ NewPlcLTIME_OF_DAY(math.MaxUint32),
+ },
+ },
{
name: apiValues.UDINT,
arguments: []argument{