diff options
author | Eric Milkie <milkie@10gen.com> | 2012-07-05 10:08:19 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2012-07-05 10:08:19 -0400 |
commit | 2ff57e149cbdf05ad5fae25230a6149fb964667e (patch) | |
tree | e4a9a7b7a04404161c7c4a37d01d6ab26febb904 | |
parent | b72aa7471cc8a6dd95c19a3246acb19a65a548eb (diff) | |
download | mongo-2ff57e149cbdf05ad5fae25230a6149fb964667e.tar.gz |
fix Windows compile
-rw-r--r-- | dbtests/queryoptimizertests.cpp | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/dbtests/queryoptimizertests.cpp b/dbtests/queryoptimizertests.cpp index 8555e3fe6e8..3c4f61fcec9 100644 --- a/dbtests/queryoptimizertests.cpp +++ b/dbtests/queryoptimizertests.cpp @@ -38,7 +38,7 @@ namespace mongo { runQuery( m, q, response ); } void __forceLinkGeoPlugin(); - shared_ptr<Cursor> newQueryOptimizerCursor( const char *ns, const BSONObj &query, const BSONObj &order = BSONObj() ); + boost::shared_ptr<Cursor> newQueryOptimizerCursor( const char *ns, const BSONObj &query, const BSONObj &order = BSONObj() ); } // namespace mongo namespace QueryOptimizerTests { @@ -51,8 +51,6 @@ namespace QueryOptimizerTests { namespace QueryPlanTests { - using boost::shared_ptr; - class Base { public: Base() : _ctx( ns() ) , indexNum_( 0 ) { @@ -990,7 +988,7 @@ namespace QueryOptimizerTests { virtual QueryOp *_createChild() const { return new PlanValidatingCursorOp( _expectedIndexKey ); } - virtual shared_ptr<Cursor> newCursor() const { return qp().newCursor(); } + virtual boost::shared_ptr<Cursor> newCursor() const { return qp().newCursor(); } virtual long long nscanned() { return 0; } private: BSONObj _expectedIndexKey; @@ -1006,7 +1004,7 @@ namespace QueryOptimizerTests { client().ensureIndex( ns(), BSON( "a" << 1 ) ); // Create a MultiCursor and validate its plans in the planValidator. - shared_ptr<MultiCursor::CursorOp> planValidator + boost::shared_ptr<MultiCursor::CursorOp> planValidator ( new PlanValidatingCursorOp( expectedPlanIndexKey() ) ); MultiCursor cursor( ns(), BSON( "a" << 1 << "b" << 1 ), BSONObj(), planValidator, false, /* hintIdElseNatural */ true ); @@ -1046,8 +1044,6 @@ namespace QueryOptimizerTests { namespace QueryOptimizerCursorTests { - using boost::shared_ptr; - class Base { public: Base() { @@ -1094,10 +1090,10 @@ namespace QueryOptimizerTests { advance(); } } - shared_ptr<Cursor> c() { return _c; } + boost::shared_ptr<Cursor> c() { return _c; } long long nscanned() const { return _c->nscanned(); } private: - shared_ptr<Cursor> _c; + boost::shared_ptr<Cursor> _c; }; /** No results for empty collection. */ @@ -1106,7 +1102,7 @@ namespace QueryOptimizerTests { void run() { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSONObj() ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSONObj() ); ASSERT( !c->ok() ); ASSERT_EXCEPTION( c->_current(), AssertionException ); ASSERT_EXCEPTION( c->current(), AssertionException ); @@ -1446,7 +1442,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), BSON( "_id" << GT << 5 << "a" << GT << 5 ) ); + boost::shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), BSON( "_id" << GT << 5 << "a" << GT << 5 ) ); ASSERT( c->ok() ); // _id 10 {_id:1} @@ -1539,7 +1535,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), fromjson( "{_id:/a/}" ) ); + boost::shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), fromjson( "{_id:/a/}" ) ); ASSERT( c->ok() ); // "a" ASSERT( c->matcher()->matchesCurrent( c.get() ) ); @@ -1571,7 +1567,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << LT << 300 ) << BSON( "a" << 1 ) ) ) ); + boost::shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << LT << 300 ) << BSON( "a" << 1 ) ) ) ); for( int i = 0; i < 151; ++i ) { ASSERT( c->ok() ); ASSERT( c->matcher()->matchesCurrent( c.get() ) ); @@ -1591,7 +1587,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), BSON( "a" << GT << 1 << LT << 5 ) ); + boost::shared_ptr< Cursor > c = newQueryOptimizerCursor( ns(), BSON( "a" << GT << 1 << LT << 5 ) ); // Two sided bounds work. ASSERT( !c->ok() ); } @@ -1626,7 +1622,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "a" << 0 << "b" << 0 ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "a" << 0 << "b" << 0 ) ); ASSERT_EQUALS( BSON( "_id" << 0 << "a" << 0 << "b" << 0 ), c->current() ); ASSERT( c->advance() ); @@ -1658,7 +1654,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << GT << 0 ) << BSON( "_id" << 1 ) ) ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << GT << 0 ) << BSON( "_id" << 1 ) ) ) ); ASSERT( c->ok() ); ASSERT( !c->advance() ); } @@ -1675,7 +1671,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << LT << 140 ) << BSON( "_id" << 145 ) << BSON( "a" << 145 ) ) ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << LT << 140 ) << BSON( "_id" << 145 ) << BSON( "a" << 145 ) ) ) ); while( c->current().getIntField( "_id" ) < 140 ) { ASSERT( c->advance() ); @@ -1719,7 +1715,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << LTE << 147 ) << BSON( "_id" << 148 ) << BSON( "_id" << 149 ) ) ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << LTE << 147 ) << BSON( "_id" << 148 ) << BSON( "_id" << 149 ) ) ) ); for( int i = 0; i < 150; ++i ) { ASSERT( c->ok() ); ASSERT_EQUALS( i, c->current().getIntField( "_id" ) ); @@ -1739,7 +1735,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "a" << LT << 6 << "b" << 4 ) << BSON( "a" << GTE << 6 << "b" << 4 ) ) ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "a" << LT << 6 << "b" << 4 ) << BSON( "a" << GTE << 6 << "b" << 4 ) ) ) ); ASSERT( c->ok() ); @@ -2282,7 +2278,7 @@ namespace QueryOptimizerTests { _cli.insert( ns(), BSON( "a" << 1 << "b" << 1 ) ); _cli.ensureIndex( ns(), BSON( "a" << 1 ) ); - shared_ptr<Cursor> c; + boost::shared_ptr<Cursor> c; { dblock lk; Client::Context ctx( ns() ); @@ -2323,7 +2319,7 @@ namespace QueryOptimizerTests { _cli.insert( ns(), BSON( "_id" << 1 << "a" << 1 ) ); _cli.ensureIndex( ns(), BSON( "_id" << 1 ) ); - shared_ptr<Cursor> c; + boost::shared_ptr<Cursor> c; { dblock lk; Client::Context ctx( ns() ); @@ -2593,7 +2589,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "a" << 2 ), BSON( "b" << 1 ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "a" << 2 ), BSON( "b" << 1 ) ); // Check that we are scanning {b:1} not {a:1}. for( int i = 0; i < 3; ++i ) { ASSERT( c->ok() ); @@ -2630,7 +2626,7 @@ namespace QueryOptimizerTests { mongolock lk( false ); Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << GT << 0 ) << BSON( "b" << GT << 0 ) ) ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "$or" << BSON_ARRAY( BSON( "_id" << GT << 0 ) << BSON( "b" << GT << 0 ) ) ) ); ASSERT( c->ok() ); cc().curop()->kill(); // First advance() call throws, subsequent calls just fail. @@ -2648,7 +2644,7 @@ namespace QueryOptimizerTests { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "_id" << GTE << 0 << "a" << GTE << 0 ) ); + boost::shared_ptr<Cursor> c = newQueryOptimizerCursor( ns(), BSON( "_id" << GTE << 0 << "a" << GTE << 0 ) ); ASSERT( c->ok() ); ASSERT_EQUALS( 2, c->nscanned() ); c->advance(); @@ -2675,7 +2671,7 @@ namespace QueryOptimizerTests { void run() { dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = NamespaceDetailsTransient::getCursor( ns(), query(), order() ); + boost::shared_ptr<Cursor> c = NamespaceDetailsTransient::getCursor( ns(), query(), order() ); string type = c->toString().substr( 0, expectedType().length() ); ASSERT_EQUALS( expectedType(), type ); check( c ); @@ -2684,7 +2680,7 @@ namespace QueryOptimizerTests { virtual string expectedType() const = 0; virtual BSONObj query() const { return BSONObj(); } virtual BSONObj order() const { return BSONObj(); } - virtual void check( const shared_ptr<Cursor> &c ) { + virtual void check( const boost::shared_ptr<Cursor> &c ) { ASSERT( c->ok() ); ASSERT( !c->matcher() ); ASSERT_EQUALS( 5, c->current().getIntField( "_id" ) ); @@ -2715,7 +2711,7 @@ namespace QueryOptimizerTests { } string expectedType() const { return "BtreeCursor a_1"; } BSONObj query() const { return BSON( "a" << GTE << 5 ); } - void check( const shared_ptr<Cursor> &c ) { + void check( const boost::shared_ptr<Cursor> &c ) { ASSERT( c->ok() ); ASSERT( c->matcher() ); ASSERT_EQUALS( 5, c->current().getIntField( "a" ) ); @@ -2735,7 +2731,7 @@ namespace QueryOptimizerTests { } string expectedType() const { return "GeoSearchCursor"; } BSONObj query() const { return fromjson( "{ loc : { $near : [50,50] } }" ); } - void check( const shared_ptr<Cursor> &c ) { + void check( const boost::shared_ptr<Cursor> &c ) { ASSERT( c->ok() ); ASSERT( c->matcher() ); ASSERT( c->matcher()->matchesCurrent( c.get() ) ); @@ -2750,7 +2746,7 @@ namespace QueryOptimizerTests { _cli.insert( ns(), BSON( "_id" << 5 ) ); dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = NamespaceDetailsTransient::getCursor( ns(), BSONObj(), BSON( "b" << 1 ) ); + boost::shared_ptr<Cursor> c = NamespaceDetailsTransient::getCursor( ns(), BSONObj(), BSON( "b" << 1 ) ); ASSERT( !c ); } }; @@ -2765,7 +2761,7 @@ namespace QueryOptimizerTests { ASSERT( _cli.query( ns(), QUERY( "_id" << GT << 0 << "b" << GT << 0 ).sort( "b" ) )->more() ); dblock lk; Client::Context ctx( ns() ); - shared_ptr<Cursor> c = NamespaceDetailsTransient::getCursor( ns(), BSON( "_id" << GT << 0 << "b" << GT << 0 ), BSON( "b" << 1 ) ); + boost::shared_ptr<Cursor> c = NamespaceDetailsTransient::getCursor( ns(), BSON( "_id" << GT << 0 << "b" << GT << 0 ), BSON( "b" << 1 ) ); // {_id:1} requires scan and order, so {b:1} must be chosen. ASSERT( c ); ASSERT_EQUALS( 5, c->current().getIntField( "_id" ) ); @@ -2779,7 +2775,7 @@ namespace QueryOptimizerTests { } string expectedType() const { return "QueryOptimizerCursor"; } BSONObj query() const { return BSON( "_id" << GT << 0 << "a" << GT << 0 ); } - void check( const shared_ptr<Cursor> &c ) {} + void check( const boost::shared_ptr<Cursor> &c ) {} }; } // namespace GetCursor |