From edb96618433f34ae3aa1654cbc83eeefaad31c76 Mon Sep 17 00:00:00 2001 From: Binbin Date: Tue, 15 Nov 2022 23:18:21 +0800 Subject: [PATCH] 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. --- tests/unit/moduleapi/reply.tcl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/unit/moduleapi/reply.tcl b/tests/unit/moduleapi/reply.tcl index 7a8e74dfc8fa..8f930138ea0b 100644 --- a/tests/unit/moduleapi/reply.tcl +++ b/tests/unit/moduleapi/reply.tcl @@ -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 } }