Skip to content

Commit

Permalink
Fixed ReadFloat test
Browse files Browse the repository at this point in the history
  • Loading branch information
samsamfire committed Dec 10, 2023
1 parent bebd61e commit 5d0642c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions network_sdo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var SDO_INTEGER_READ_MAP = map[string]int64{
}

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

Expand Down Expand Up @@ -84,7 +84,7 @@ func TestReadFloat(t *testing.T) {
defer network.Disconnect()
for indexName, key := range SDO_FLOAT_READ_MAP {
val, _ := network.ReadFloat(NODE_ID_TEST, indexName, "")
if val != key {
if math.Abs(val-key) > 0.01 {
t.Errorf("error or incorrect value %v (%v expected)", val, key)
}
}
Expand Down

0 comments on commit 5d0642c

Please sign in to comment.