diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-04-09 14:40:10 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-04-15 19:28:35 -0400 |
commit | a1a846bdc63b92474fcf3477aea472a7e11cd438 (patch) | |
tree | 440859b71041c4260c1359c0e0bda6fff14f179a /src/mongo/db/storage/sorted_data_interface_test_isempty.cpp | |
parent | 6546083077887e8dc6ea47c26dc4631709a8ff99 (diff) | |
download | mongo-a1a846bdc63b92474fcf3477aea472a7e11cd438.tar.gz |
SERVER-17635 Improve SDI unittest helpers
* Added a declaritive way to set index contents
* Use std::unique_ptr throughout
Diffstat (limited to 'src/mongo/db/storage/sorted_data_interface_test_isempty.cpp')
-rw-r--r-- | src/mongo/db/storage/sorted_data_interface_test_isempty.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp b/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp index d8d40a58cbc..8dcef9a3770 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_isempty.cpp @@ -30,29 +30,27 @@ #include "mongo/db/storage/sorted_data_interface_test_harness.h" -#include <boost/scoped_ptr.hpp> +#include <memory> #include "mongo/db/storage/sorted_data_interface.h" #include "mongo/unittest/unittest.h" namespace mongo { - using boost::scoped_ptr; - // Verify that isEmpty() returns true when the index is empty, // returns false when a key is inserted, and returns true again // when that is unindex. TEST( SortedDataInterface, IsEmpty ) { - scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); + const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); + const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT( sorted->isEmpty( opCtx.get() ) ); } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) ); @@ -61,12 +59,12 @@ namespace mongo { } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT( !sorted->isEmpty( opCtx.get() ) ); } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); { WriteUnitOfWork uow( opCtx.get() ); sorted->unindex( opCtx.get(), key1, loc1, false ); @@ -76,7 +74,7 @@ namespace mongo { } { - scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); + const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); ASSERT( sorted->isEmpty( opCtx.get() ) ); } } |