Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double negative nan test, ignoring sign #11506

Merged
merged 3 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/support/test.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ proc assert_match {pattern value {detail ""}} {
}
}

proc assert_match_nocase {pattern value {detail ""}} {
if {![string match -nocase $pattern $value]} {
set context "(context: [info frame -1])"
error "assertion:Expected '$value' to match (no case) '$pattern' $context $detail"
}
}

proc assert_failed {expected_err detail} {
if {$detail ne ""} {
set detail "(detail: $detail)"
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/moduleapi/reply.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ start_server {tags {"modules"}} {

test "RESP$proto: RM_ReplyWithDouble: NaN" {
if {$proto == 2} {
assert_equal "-nan" [r rw.double 0 0]
# nan on ARM, -nan on others, so here we match ignoring case and sign
assert_match_nocase "*nan" [r rw.double 0 0]
assert_equal "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]
# nan on ARM, -nan on others, so here we match ignoring case and sign
assert_match_nocase ",*nan" [r rw.double 0 0]
assert_equal ",nan" [r rw.double]
r readraw 0
}
Expand Down