diff options
Diffstat (limited to 'src/mongo/db/storage/sorted_data_interface_test_touch.cpp')
-rw-r--r-- | src/mongo/db/storage/sorted_data_interface_test_touch.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp index 83a3c314ef9..07ec83fb9c7 100644 --- a/src/mongo/db/storage/sorted_data_interface_test_touch.cpp +++ b/src/mongo/db/storage/sorted_data_interface_test_touch.cpp @@ -37,51 +37,51 @@ namespace mongo { - // Verify that calling touch() on an empty index returns an OK status. - TEST( SortedDataInterface, TouchEmpty ) { - const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( false ) ); +// Verify that calling touch() on an empty index returns an OK status. +TEST(SortedDataInterface, TouchEmpty) { + const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper()); + const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(false)); - { - const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - Status status = sorted->touch( opCtx.get() ); - ASSERT( status.isOK() || status.code() == ErrorCodes::CommandNotSupported ); - } + { + const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext()); + Status status = sorted->touch(opCtx.get()); + ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported); } +} - // Verify that calling touch() on a nonempty index returns an OK status. - TEST( SortedDataInterface, TouchNonEmpty ) { - const std::unique_ptr<HarnessHelper> harnessHelper( newHarnessHelper() ); - const std::unique_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface( true ) ); +// Verify that calling touch() on a nonempty index returns an OK status. +TEST(SortedDataInterface, TouchNonEmpty) { + const std::unique_ptr<HarnessHelper> harnessHelper(newHarnessHelper()); + const std::unique_ptr<SortedDataInterface> sorted(harnessHelper->newSortedDataInterface(true)); - { - const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - ASSERT( sorted->isEmpty( opCtx.get() ) ); - } + { + const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext()); + ASSERT(sorted->isEmpty(opCtx.get())); + } + { + const std::unique_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 ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key2, loc2, false ) ); - ASSERT_OK( sorted->insert( opCtx.get(), key3, loc3, false ) ); - uow.commit(); - } + WriteUnitOfWork uow(opCtx.get()); + ASSERT_OK(sorted->insert(opCtx.get(), key1, loc1, false)); + ASSERT_OK(sorted->insert(opCtx.get(), key2, loc2, false)); + ASSERT_OK(sorted->insert(opCtx.get(), key3, loc3, false)); + uow.commit(); } + } - { - const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - ASSERT_EQUALS( 3, sorted->numEntries( opCtx.get() ) ); - } + { + const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext()); + ASSERT_EQUALS(3, sorted->numEntries(opCtx.get())); + } - { - const std::unique_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() ); - // XXX does not verify the index was brought into memory - // (even if supported by storage engine) - Status status = sorted->touch( opCtx.get() ); - ASSERT( status.isOK() || status.code() == ErrorCodes::CommandNotSupported ); - } + { + const std::unique_ptr<OperationContext> opCtx(harnessHelper->newOperationContext()); + // XXX does not verify the index was brought into memory + // (even if supported by storage engine) + Status status = sorted->touch(opCtx.get()); + ASSERT(status.isOK() || status.code() == ErrorCodes::CommandNotSupported); } +} -} // namespace mongo +} // namespace mongo |