Fix double negative nan test, ignoring sign (#11506)

The test introduced in #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.
This commit is contained in:
Binbin 2022-11-15 23:18:21 +08:00 committed by GitHub
parent e4eb18b303
commit a4bcdbcfd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}