summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/key_string_test.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-01-07 00:54:51 -0500
committerMathias Stearn <mathias@10gen.com>2015-01-07 11:56:33 -0500
commit331911d3f31cf93c82bfaab3b6db0a77fdb80374 (patch)
tree75a53457f0d5830d9cd49e091e36a51df678fb6f /src/mongo/db/storage/key_string_test.cpp
parent5d46a3a9f7b7f8b17ae1cbe73dd9f8d056350b81 (diff)
downloadmongo-331911d3f31cf93c82bfaab3b6db0a77fdb80374.tar.gz
SERVER-16632 Remove unneeded kEquals byte after each field in KeyString
Diffstat (limited to 'src/mongo/db/storage/key_string_test.cpp')
-rw-r--r--src/mongo/db/storage/key_string_test.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/mongo/db/storage/key_string_test.cpp b/src/mongo/db/storage/key_string_test.cpp
index bf0e7cd88c1..9430c8dd62c 100644
--- a/src/mongo/db/storage/key_string_test.cpp
+++ b/src/mongo/db/storage/key_string_test.cpp
@@ -97,12 +97,11 @@ TEST(KeyStringTest, ActualBytesDouble) {
KeyString ks = KeyString::make(a, ALL_ASCENDING);
log() << "size: " << ks.getSize() << " hex [" << toHex(ks.getBuffer(), ks.getSize()) << "]";
- ASSERT_EQUALS(11U, ks.getSize());
+ ASSERT_EQUALS(10U, ks.getSize());
string hex = "2B" // kNumericPositive1ByteInt
"0B" // (5 << 1) | 1
"02000000000000" // fractional bytes of double
- "02" // kEqual
"04"; // kEnd
ASSERT_EQUALS(hex,
@@ -110,17 +109,17 @@ TEST(KeyStringTest, ActualBytesDouble) {
ks = KeyString::make(a, Ordering::make(BSON("a" << -1)));
- ASSERT_EQUALS(11U, ks.getSize());
+ ASSERT_EQUALS(10U, ks.getSize());
- // last 2 bytes don't get flipped
+ // last byte (kEnd) doesn't get flipped
string hexFlipped;
- for ( size_t i = 0; i < hex.size()-4; i += 2 ) {
+ for ( size_t i = 0; i < hex.size()-2; i += 2 ) {
char c = fromHex(hex.c_str() + i);
c = ~c;
hexFlipped += toHex(&c, 1);
}
- hexFlipped += hex.substr(hex.size()-4);
+ hexFlipped += hex.substr(hex.size()-2);
ASSERT_EQUALS(hexFlipped,
toHex(ks.getBuffer(), ks.getSize()));