diff options
Diffstat (limited to 'src/mongo/db/storage/record_store_test_touch.cpp')
-rw-r--r-- | src/mongo/db/storage/record_store_test_touch.cpp | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/mongo/db/storage/record_store_test_touch.cpp b/src/mongo/db/storage/record_store_test_touch.cpp index d1bcdfe488c..80b8909611c 100644 --- a/src/mongo/db/storage/record_store_test_touch.cpp +++ b/src/mongo/db/storage/record_store_test_touch.cpp @@ -30,12 +30,11 @@ #include "mongo/db/storage/record_store_test_harness.h" -#include <boost/scoped_ptr.hpp> #include "mongo/db/storage/record_store.h" #include "mongo/unittest/unittest.h" -using boost::scoped_ptr; +using std::unique_ptr; using std::string; using std::stringstream; @@ -43,16 +42,16 @@ namespace mongo { // Verify that calling touch() on an empty collection returns an OK status. TEST( RecordStoreTestHarness, TouchEmpty ) { - scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); + unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { BSONObjBuilder stats; Status status = rs->touch( opCtx.get(), &stats ); @@ -64,17 +63,17 @@ namespace mongo { // Insert multiple records, and verify that calling touch() on a nonempty collection // returns an OK status. TEST( RecordStoreTestHarness, TouchNonEmpty ) { - scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); + unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -91,12 +90,12 @@ namespace mongo { } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { BSONObjBuilder stats; // XXX does not verify the collection was loaded into cache @@ -110,16 +109,16 @@ namespace mongo { // Verify that calling touch() on an empty collection returns an OK status, // even when NULL is passed in for the stats output. TEST( RecordStoreTestHarness, TouchEmptyWithNullStats ) { - scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); + unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); Status status = rs->touch( opCtx.get(), NULL /* stats output */ ); ASSERT( status.isOK() || status.code() == ErrorCodes::CommandNotSupported ); } @@ -128,17 +127,17 @@ namespace mongo { // Insert multiple records, and verify that calling touch() on a nonempty collection // returns an OK status, even when NULL is passed in for the stats output. TEST( RecordStoreTestHarness, TouchNonEmptyWithNullStats ) { - scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); + unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); + unique_ptr<RecordStore> rs( harnessHelper->newNonCappedRecordStore() ); { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( 0, rs->numRecords( opCtx.get() ) ); } int nToInsert = 10; for ( int i = 0; i < nToInsert; i++ ) { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { stringstream ss; ss << "record " << i; @@ -155,12 +154,12 @@ namespace mongo { } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT_EQUALS( nToInsert, rs->numRecords( opCtx.get() ) ); } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); // XXX does not verify the collection was loaded into cache // (even if supported by storage engine) Status status = rs->touch( opCtx.get(), NULL /* stats output */ ); |