diff --git a/pkg/network/network_test.go b/pkg/network/network_test.go index 14bd329..5d4d86c 100644 --- a/pkg/network/network_test.go +++ b/pkg/network/network_test.go @@ -84,9 +84,3 @@ func TestAddRemoveNodes(t *testing.T) { }) } - -// func TestRemoveNode(t *testing.T) { -// network := CreateNetworkTest() -// defer network.Disconnect() -// network.RemoveNode(NODE_ID_TEST) -// } diff --git a/pkg/network/node_test.go b/pkg/network/node_test.go index db45152..bc620b6 100644 --- a/pkg/network/node_test.go +++ b/pkg/network/node_test.go @@ -1,7 +1,6 @@ package network import ( - "math" "testing" "time" @@ -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() { @@ -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) } }) @@ -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) } }) @@ -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, "") diff --git a/pkg/od/base.eds b/pkg/od/base.eds index a0fc88e..2718ec7 100644 --- a/pkg/od/base.eds +++ b/pkg/od/base.eds @@ -1943,7 +1943,7 @@ PDOMapping=1 ParameterName=REAL32 value ObjectType=0x7 DataType=0x0008 -DefaultValue=0x55555555 +DefaultValue=0.1 AccessType=rw PDOMapping=1 @@ -1968,7 +1968,7 @@ PDOMapping=0 ParameterName=REAL64 value ObjectType=0x7 DataType=0x0011 -DefaultValue=0x55555555 +DefaultValue=0.55 AccessType=rw PDOMapping=1