Skip to content

Commit

Permalink
Fix double negative nan test, ignoring sign (redis#11506)
Browse files Browse the repository at this point in the history
The test introduced in redis#11482 fail on ARM (extra CI):
```
*** [err]: RESP2: RM_ReplyWithDouble: NaN in tests/unit/moduleapi/reply.tcl
Expected '-nan' to be equal to 'nan' (context: type eval line 3 cmd
{assert_equal "-nan" [r rw.double 0 0]} proc ::test)

*** [err]: RESP3: RM_ReplyWithDouble: NaN in tests/unit/moduleapi/reply.tcl
Expected ',-nan' to be equal to ',nan' (context: type eval line 8 cmd
{assert_equal ",-nan" [r rw.double 0 0]} proc ::test)
```

It looks like there is no negative nan on ARM.
  • Loading branch information
enjoy-binbin authored and madolson committed Apr 19, 2023
1 parent 4052ac9 commit a8d49b0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/unit/moduleapi/reply.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ start_server {tags {"modules"}} {
}

test "RESP$proto: RM_ReplyWithDouble: NaN" {
# On some platforms one of these can be -nan but we don't care since they are
# synonym, so here we match ignoring the sign
if {$proto == 2} {
assert_equal "-nan" [r rw.double 0 0]
assert_equal "nan" [r rw.double]
assert_match "*nan" [r rw.double 0 0]
assert_match "*nan" [r rw.double]
} else {
# TCL won't convert nan into a double, use readraw to verify the protocol
r readraw 1
assert_equal ",-nan" [r rw.double 0 0]
assert_equal ",nan" [r rw.double]
assert_match ",*nan" [r rw.double 0 0]
assert_match ",*nan" [r rw.double]
r readraw 0
}
}
Expand Down

0 comments on commit a8d49b0

Please sign in to comment.