diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2019-04-23 17:27:07 -0400 |
---|---|---|
committer | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2019-04-24 21:55:52 -0400 |
commit | 5e346eb4b9bb3ec678d4eac36b3f0a18c1c10939 (patch) | |
tree | 4af3ebd9563c61399458158d88faf7e6dc796ff4 /src/mongo/unittest | |
parent | b9c656f6e2d0b0b7676927538ed7ac3278c23322 (diff) | |
download | mongo-5e346eb4b9bb3ec678d4eac36b3f0a18c1c10939.tar.gz |
SERVER-4999 Normalize all hostnames to lowercase
Hostnames passed to replSetInitiate, replSetReconfig, addShard, etc. are
all normalized by replacing ASCII uppercase characters with lowercase
characters, consistent with how MongoDB drivers treat hostnames.
Fixes undefined behavior in mongo::str::toLower().
Diffstat (limited to 'src/mongo/unittest')
-rw-r--r-- | src/mongo/unittest/unittest.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index d00338348a9..9eba2c2bc3c 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -113,6 +113,11 @@ #define ASSERT_APPROX_EQUAL(a, b, ABSOLUTE_ERR) ASSERT_LTE(std::abs((a) - (b)), ABSOLUTE_ERR) /** + * ASCII case-insensitive comparison. + */ +#define ASSERT_EQUALS_CI(a, b) ASSERT_EQUALS(str::toLower(a), str::toLower(b)) + +/** * Assert a function call returns its input unchanged. */ #define ASSERT_IDENTITY(INPUT, FUNCTION) \ |