summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-08-25 18:30:51 -0400
committerEliot Horowitz <eliot@10gen.com>2010-08-25 18:30:51 -0400
commitc78415729edb31d87133637113e976962bed584b (patch)
tree45c5093b669f6e2cd02cd69dd427142fd4fb7a07 /dbtests
parent666af2a1b9c4d948b45cbd86337c1f2dffe45bea (diff)
downloadmongo-c78415729edb31d87133637113e976962bed584b.tar.gz
fix lexNumCmp with magic end of marker
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/basictests.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/dbtests/basictests.cpp b/dbtests/basictests.cpp
index 27f7cdc90e2..ecba7650be7 100644
--- a/dbtests/basictests.cpp
+++ b/dbtests/basictests.cpp
@@ -319,6 +319,9 @@ namespace BasicTests {
class LexNumCmp {
public:
void run() {
+
+ ASSERT( ! isNumber( (char)255 ) );
+
ASSERT_EQUALS( 0, lexNumCmp( "a", "a" ) );
ASSERT_EQUALS( -1, lexNumCmp( "a", "aa" ) );
ASSERT_EQUALS( 1, lexNumCmp( "aa", "a" ) );
@@ -346,7 +349,7 @@ namespace BasicTests {
ASSERT_EQUALS( -1, lexNumCmp( "f12f", "f12g" ) );
ASSERT_EQUALS( 1, lexNumCmp( "f12g", "f12f" ) );
ASSERT_EQUALS( 1, lexNumCmp( "aa{", "aab" ) );
- ASSERT_EQUALS( 1, lexNumCmp( "aa{", "aa1" ) );
+ ASSERT_EQUALS( -1, lexNumCmp( "aa{", "aa1" ) );
ASSERT_EQUALS( -1, lexNumCmp( "a1{", "a11" ) );
ASSERT_EQUALS( 1, lexNumCmp( "a1{a", "a1{" ) );
ASSERT_EQUALS( -1, lexNumCmp( "a1{", "a1{a" ) );
@@ -355,6 +358,10 @@ namespace BasicTests {
ASSERT_EQUALS( -1 , lexNumCmp( "a.0" , "a.1" ) );
ASSERT_EQUALS( -1 , lexNumCmp( "a.0.b" , "a.1" ) );
+
+ ASSERT_EQUALS( -1 , lexNumCmp( "b." , "b.|" ) );
+ ASSERT_EQUALS( -1 , lexNumCmp( "b.0e" , (string("b.") + (char)255).c_str() ) );
+ ASSERT_EQUALS( -1 , lexNumCmp( "b." , "b.0e" ) );
}
};