Skip to content

Commit

Permalink
Fixed : update eds to use float & updated corresponding tests
Browse files Browse the repository at this point in the history
Changed : removed duplicate test
  • Loading branch information
samsamfire committed Jun 9, 2024
1 parent 805316d commit 33f9eae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
6 changes: 0 additions & 6 deletions pkg/network/network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,3 @@ func TestAddRemoveNodes(t *testing.T) {
})

}

// func TestRemoveNode(t *testing.T) {
// network := CreateNetworkTest()
// defer network.Disconnect()
// network.RemoveNode(NODE_ID_TEST)
// }
18 changes: 4 additions & 14 deletions pkg/network/node_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package network

import (
"math"
"testing"
"time"

Expand All @@ -26,8 +25,8 @@ var SDO_INTEGER_READ_MAP = map[string]int64{
}

var SDO_FLOAT_READ_MAP = map[string]float64{
"REAL32 value": float64(math.Float32frombits(uint32(0x55555555))),
"REAL64 value": math.Float64frombits(0x55555555),
"REAL32 value": float64(0.1),
"REAL64 value": float64(0.55),
}

func init() {
Expand Down Expand Up @@ -62,7 +61,7 @@ func TestReadLocal(t *testing.T) {
}
for indexName, key := range SDO_FLOAT_READ_MAP {
val, _ := local.Read(indexName, "")
assert.Equal(t, key, val)
assert.InDelta(t, key, val, 1e-5)
}

})
Expand Down Expand Up @@ -135,7 +134,7 @@ func TestReadRemote(t *testing.T) {
}
for indexName, key := range SDO_FLOAT_READ_MAP {
val, _ := remote.Read(indexName, "")
assert.Equal(t, key, val)
assert.InDelta(t, key, val, 1e-5)
}

})
Expand All @@ -148,15 +147,6 @@ func TestReadRemote(t *testing.T) {
assert.Equal(t, od.ErrTypeMismatch, err)
})

t.Run("Read Uint", func(t *testing.T) {
for indexName, key := range SDO_UNSIGNED_READ_MAP {
val, _ := remote.ReadUint(indexName, "")
assert.Equal(t, key, val)
}
_, err := remote.ReadUint("INTEGER8 value", "")
assert.Equal(t, od.ErrTypeMismatch, err)
})

t.Run("Read Int", func(t *testing.T) {
for indexName, key := range SDO_INTEGER_READ_MAP {
val, _ := remote.ReadInt(indexName, "")
Expand Down
4 changes: 2 additions & 2 deletions pkg/od/base.eds
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ PDOMapping=1
ParameterName=REAL32 value
ObjectType=0x7
DataType=0x0008
DefaultValue=0x55555555
DefaultValue=0.1
AccessType=rw
PDOMapping=1

Expand All @@ -1968,7 +1968,7 @@ PDOMapping=0
ParameterName=REAL64 value
ObjectType=0x7
DataType=0x0011
DefaultValue=0x55555555
DefaultValue=0.55
AccessType=rw
PDOMapping=1

Expand Down

0 comments on commit 33f9eae

Please sign in to comment.