diff options
Diffstat (limited to 'dbtests')
-rw-r--r-- | dbtests/basictests.cpp | 5 | ||||
-rw-r--r-- | dbtests/btreetests.cpp | 38 | ||||
-rw-r--r-- | dbtests/framework.cpp | 2 | ||||
-rw-r--r-- | dbtests/repltests.cpp | 3 |
4 files changed, 43 insertions, 5 deletions
diff --git a/dbtests/basictests.cpp b/dbtests/basictests.cpp index eaadf75..4c80cd4 100644 --- a/dbtests/basictests.cpp +++ b/dbtests/basictests.cpp @@ -306,11 +306,14 @@ namespace BasicTests { ASSERT_EQUALS( 1, lexNumCmp( "f12g", "f12f" ) ); ASSERT_EQUALS( 1, lexNumCmp( "aa{", "aab" ) ); ASSERT_EQUALS( 1, lexNumCmp( "aa{", "aa1" ) ); - ASSERT_EQUALS( 1, lexNumCmp( "a1{", "a11" ) ); + ASSERT_EQUALS( -1, lexNumCmp( "a1{", "a11" ) ); ASSERT_EQUALS( 1, lexNumCmp( "a1{a", "a1{" ) ); ASSERT_EQUALS( -1, lexNumCmp( "a1{", "a1{a" ) ); ASSERT_EQUALS( 1, lexNumCmp("21", "11") ); ASSERT_EQUALS( -1, lexNumCmp("11", "21") ); + + ASSERT_EQUALS( -1 , lexNumCmp( "a.0" , "a.1" ) ); + ASSERT_EQUALS( -1 , lexNumCmp( "a.0.b" , "a.1" ) ); } }; diff --git a/dbtests/btreetests.cpp b/dbtests/btreetests.cpp index 3c9dc8d..390071f 100644 --- a/dbtests/btreetests.cpp +++ b/dbtests/btreetests.cpp @@ -72,6 +72,9 @@ namespace BtreeTests { bt()->assertValid( order(), true ); ASSERT_EQUALS( nKeys, bt()->fullValidate( dl(), order() ) ); } + void dump() { + bt()->dumpTree( dl(), order() ); + } void insert( BSONObj &key ) { bt()->bt_insert( dl(), recordLoc(), key, order(), true, id(), true ); } @@ -206,10 +209,12 @@ namespace BtreeTests { class MissingLocateMultiBucket : public Base { public: void run() { - for ( int i = 0; i < 10; ++i ) { - BSONObj k = key( 'b' + 2 * i ); - insert( k ); + for ( int i = 0; i < 8; ++i ) { + insert( i ); } + insert( 9 ); + insert( 8 ); +// dump(); BSONObj straddle = key( 'i' ); locate( straddle, 0, false, dl(), 1 ); straddle = key( 'k' ); @@ -219,8 +224,34 @@ namespace BtreeTests { BSONObj key( char c ) { return simpleKey( c, 800 ); } + void insert( int i ) { + BSONObj k = key( 'b' + 2 * i ); + Base::insert( k ); + } }; + class SERVER983 : public Base { + public: + void run() { + for ( int i = 0; i < 10; ++i ) { + insert( i ); + } +// dump(); + BSONObj straddle = key( 'o' ); + locate( straddle, 0, false, dl(), 1 ); + straddle = key( 'q' ); + locate( straddle, 0, false, dl(), -1 ); + } + private: + BSONObj key( char c ) { + return simpleKey( c, 800 ); + } + void insert( int i ) { + BSONObj k = key( 'b' + 2 * i ); + Base::insert( k ); + } + }; + class All : public Suite { public: All() : Suite( "btree" ){ @@ -233,6 +264,7 @@ namespace BtreeTests { add< SplitLeftHeavyBucket >(); add< MissingLocate >(); add< MissingLocateMultiBucket >(); + add< SERVER983 >(); } } myall; } diff --git a/dbtests/framework.cpp b/dbtests/framework.cpp index 4553686..0566aa8 100644 --- a/dbtests/framework.cpp +++ b/dbtests/framework.cpp @@ -34,6 +34,8 @@ namespace po = boost::program_options; namespace mongo { + CmdLine cmdLine; + namespace regression { map<string,Suite*> * mongo::regression::Suite::_suites = 0; diff --git a/dbtests/repltests.cpp b/dbtests/repltests.cpp index c6ef6c2..53e3609 100644 --- a/dbtests/repltests.cpp +++ b/dbtests/repltests.cpp @@ -1053,7 +1053,8 @@ namespace ReplTests { check(); ASSERT( !s_.inMem() ); - s_.reset(); + s_.reset( 4 * sizeof( BSONObj ) - 1 ); + s_.mayUpgradeStorage(); ASSERT( s_.inMem() ); } private: |