diff --git a/implementations/caching/CachedBlock.cpp b/implementations/caching/CachedBlock.cpp index 141c01a8..399032f8 100644 --- a/implementations/caching/CachedBlock.cpp +++ b/implementations/caching/CachedBlock.cpp @@ -1,7 +1,6 @@ #include "CachedBlock.h" #include "CachingBlockStore.h" -using std::unique_ptr; using cpputils::unique_ref; namespace blockstore { diff --git a/implementations/caching/CachingBlockStore.cpp b/implementations/caching/CachingBlockStore.cpp index 2f01e52a..e2c9d5bf 100644 --- a/implementations/caching/CachingBlockStore.cpp +++ b/implementations/caching/CachingBlockStore.cpp @@ -6,8 +6,6 @@ #include #include -using std::unique_ptr; -using std::make_unique; using cpputils::dynamic_pointer_move; using cpputils::Data; using boost::optional; @@ -18,7 +16,7 @@ using boost::none; namespace blockstore { namespace caching { -CachingBlockStore::CachingBlockStore(std::unique_ptr baseBlockStore) +CachingBlockStore::CachingBlockStore(cpputils::unique_ref baseBlockStore) :_baseBlockStore(std::move(baseBlockStore)), _cache(), _numNewBlocks(0) { } diff --git a/implementations/caching/CachingBlockStore.h b/implementations/caching/CachingBlockStore.h index 96f065fe..e4a7e07e 100644 --- a/implementations/caching/CachingBlockStore.h +++ b/implementations/caching/CachingBlockStore.h @@ -11,7 +11,7 @@ namespace caching { //TODO Check that this blockstore allows parallel destructing of blocks (otherwise we won't encrypt blocks in parallel) class CachingBlockStore: public BlockStore { public: - explicit CachingBlockStore(std::unique_ptr baseBlockStore); + explicit CachingBlockStore(cpputils::unique_ref baseBlockStore); Key createKey() override; boost::optional> tryCreate(const Key &key, cpputils::Data data) override; @@ -25,7 +25,7 @@ public: void removeFromBaseStore(cpputils::unique_ref block); private: - std::unique_ptr _baseBlockStore; + cpputils::unique_ref _baseBlockStore; Cache> _cache; uint32_t _numNewBlocks; diff --git a/implementations/caching/NewBlock.cpp b/implementations/caching/NewBlock.cpp index 61c63cf1..5cae9b8c 100644 --- a/implementations/caching/NewBlock.cpp +++ b/implementations/caching/NewBlock.cpp @@ -1,7 +1,6 @@ #include "NewBlock.h" #include "CachingBlockStore.h" -using std::unique_ptr; using cpputils::Data; using boost::none; diff --git a/implementations/encrypted/EncryptedBlockStore.h b/implementations/encrypted/EncryptedBlockStore.h index 54308e18..a574a3d7 100644 --- a/implementations/encrypted/EncryptedBlockStore.h +++ b/implementations/encrypted/EncryptedBlockStore.h @@ -14,7 +14,7 @@ namespace encrypted { template class EncryptedBlockStore: public BlockStore { public: - EncryptedBlockStore(std::unique_ptr baseBlockStore, const typename Cipher::EncryptionKey &encKey); + EncryptedBlockStore(cpputils::unique_ref baseBlockStore, const typename Cipher::EncryptionKey &encKey); //TODO Are createKey() tests included in generic BlockStoreTest? If not, add it! Key createKey() override; @@ -27,7 +27,7 @@ public: void __setKey(const typename Cipher::EncryptionKey &encKey); private: - std::unique_ptr _baseBlockStore; + cpputils::unique_ref _baseBlockStore; typename Cipher::EncryptionKey _encKey; DISALLOW_COPY_AND_ASSIGN(EncryptedBlockStore); @@ -36,7 +36,7 @@ private: template -EncryptedBlockStore::EncryptedBlockStore(std::unique_ptr baseBlockStore, const typename Cipher::EncryptionKey &encKey) +EncryptedBlockStore::EncryptedBlockStore(cpputils::unique_ref baseBlockStore, const typename Cipher::EncryptionKey &encKey) : _baseBlockStore(std::move(baseBlockStore)), _encKey(encKey) { } diff --git a/implementations/inmemory/InMemoryBlock.cpp b/implementations/inmemory/InMemoryBlock.cpp index 14d27df9..fcbf152d 100644 --- a/implementations/inmemory/InMemoryBlock.cpp +++ b/implementations/inmemory/InMemoryBlock.cpp @@ -2,7 +2,6 @@ #include "InMemoryBlockStore.h" #include -using std::unique_ptr; using std::make_shared; using std::istream; using std::ostream; diff --git a/implementations/inmemory/InMemoryBlockStore.cpp b/implementations/inmemory/InMemoryBlockStore.cpp index 0b627933..3540d5d4 100644 --- a/implementations/inmemory/InMemoryBlockStore.cpp +++ b/implementations/inmemory/InMemoryBlockStore.cpp @@ -2,7 +2,6 @@ #include "InMemoryBlockStore.h" #include -using std::unique_ptr; using std::make_unique; using std::string; using std::mutex; @@ -43,7 +42,7 @@ optional> InMemoryBlockStore::load(const Key &key) { void InMemoryBlockStore::remove(unique_ref block) { Key key = block->key(); - cpputils::to_unique_ptr(std::move(block)).reset(); // Call destructor + cpputils::destruct(std::move(block)); int numRemoved = _blocks.erase(key.ToString()); assert(1==numRemoved); } diff --git a/implementations/ondisk/OnDiskBlock.cpp b/implementations/ondisk/OnDiskBlock.cpp index 2c753b0a..15db611d 100644 --- a/implementations/ondisk/OnDiskBlock.cpp +++ b/implementations/ondisk/OnDiskBlock.cpp @@ -5,8 +5,6 @@ #include "OnDiskBlockStore.h" #include "../../utils/FileDoesntExistException.h" -using std::unique_ptr; -using std::make_unique; using std::istream; using std::ostream; using std::ifstream; diff --git a/implementations/ondisk/OnDiskBlockStore.cpp b/implementations/ondisk/OnDiskBlockStore.cpp index 2e4de86f..53adff6a 100644 --- a/implementations/ondisk/OnDiskBlockStore.cpp +++ b/implementations/ondisk/OnDiskBlockStore.cpp @@ -1,8 +1,6 @@ #include "OnDiskBlock.h" #include "OnDiskBlockStore.h" -using std::unique_ptr; -using std::make_unique; using std::string; using cpputils::Data; using cpputils::unique_ref; @@ -32,7 +30,7 @@ optional> OnDiskBlockStore::load(const Key &key) { void OnDiskBlockStore::remove(unique_ref block) { Key key = block->key(); - cpputils::to_unique_ptr(std::move(block)).reset(); // Call destructor + cpputils::destruct(std::move(block)); OnDiskBlock::RemoveFromDisk(_rootdir, key); } diff --git a/implementations/parallelaccess/ParallelAccessBlockStore.cpp b/implementations/parallelaccess/ParallelAccessBlockStore.cpp index e2b42fb3..fece925b 100644 --- a/implementations/parallelaccess/ParallelAccessBlockStore.cpp +++ b/implementations/parallelaccess/ParallelAccessBlockStore.cpp @@ -4,9 +4,6 @@ #include #include - -using std::unique_ptr; -using std::make_unique; using std::string; using std::mutex; using std::lock_guard; diff --git a/implementations/testfake/FakeBlock.cpp b/implementations/testfake/FakeBlock.cpp index b6505aa7..354553e8 100644 --- a/implementations/testfake/FakeBlock.cpp +++ b/implementations/testfake/FakeBlock.cpp @@ -2,7 +2,6 @@ #include "FakeBlockStore.h" #include -using std::unique_ptr; using std::shared_ptr; using std::istream; using std::ostream; diff --git a/implementations/testfake/FakeBlockStore.cpp b/implementations/testfake/FakeBlockStore.cpp index 51abce98..aa311091 100644 --- a/implementations/testfake/FakeBlockStore.cpp +++ b/implementations/testfake/FakeBlockStore.cpp @@ -1,8 +1,6 @@ #include "FakeBlock.h" #include "FakeBlockStore.h" -using std::unique_ptr; -using std::make_unique; using std::make_shared; using std::string; using std::mutex; @@ -42,7 +40,7 @@ optional> FakeBlockStore::load(const Key &key) { void FakeBlockStore::remove(unique_ref block) { Key key = block->key(); - cpputils::to_unique_ptr(std::move(block)).reset(); // Call destructor + cpputils::destruct(std::move(block)); int numRemoved = _blocks.erase(key.ToString()); assert(numRemoved == 1); } diff --git a/test/implementations/caching/CachingBlockStoreTest.cpp b/test/implementations/caching/CachingBlockStoreTest.cpp index 02955ff3..1b6804b2 100644 --- a/test/implementations/caching/CachingBlockStoreTest.cpp +++ b/test/implementations/caching/CachingBlockStoreTest.cpp @@ -7,14 +7,13 @@ using blockstore::BlockStore; using blockstore::caching::CachingBlockStore; using blockstore::testfake::FakeBlockStore; - -using std::unique_ptr; -using std::make_unique; +using cpputils::unique_ref; +using cpputils::make_unique_ref; class CachingBlockStoreTestFixture: public BlockStoreTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(make_unique()); + unique_ref createBlockStore() override { + return make_unique_ref(make_unique_ref()); } }; diff --git a/test/implementations/caching/cache/CacheTest_MoveConstructor.cpp b/test/implementations/caching/cache/CacheTest_MoveConstructor.cpp index 5efba4a8..6bb1d4f6 100644 --- a/test/implementations/caching/cache/CacheTest_MoveConstructor.cpp +++ b/test/implementations/caching/cache/CacheTest_MoveConstructor.cpp @@ -1,23 +1,22 @@ #include -#include +#include #include "../../../../implementations/caching/cache/Cache.h" #include "testutils/MinimalKeyType.h" #include "testutils/CopyableMovableValueType.h" using namespace blockstore::caching; +using cpputils::unique_ref; +using cpputils::make_unique_ref; using ::testing::Test; -using std::unique_ptr; -using std::make_unique; //Test that Cache uses a move constructor for Value if possible class CacheTest_MoveConstructor: public Test { public: - CacheTest_MoveConstructor() { + CacheTest_MoveConstructor(): cache(make_unique_ref>()) { CopyableMovableValueType::numCopyConstructorCalled = 0; - cache = make_unique>(); } - unique_ptr> cache; + unique_ref> cache; }; TEST_F(CacheTest_MoveConstructor, MoveIntoCache) { diff --git a/test/implementations/caching/cache/QueueMapTest_MoveConstructor.cpp b/test/implementations/caching/cache/QueueMapTest_MoveConstructor.cpp index 4a1f15db..aab5eee9 100644 --- a/test/implementations/caching/cache/QueueMapTest_MoveConstructor.cpp +++ b/test/implementations/caching/cache/QueueMapTest_MoveConstructor.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "../../../../implementations/caching/cache/QueueMap.h" #include "testutils/MinimalKeyType.h" #include "testutils/CopyableMovableValueType.h" @@ -7,17 +7,16 @@ using namespace blockstore::caching; using ::testing::Test; -using std::unique_ptr; -using std::make_unique; +using cpputils::unique_ref; +using cpputils::make_unique_ref; //Test that QueueMap uses a move constructor for Value if possible class QueueMapTest_MoveConstructor: public Test { public: - QueueMapTest_MoveConstructor() { + QueueMapTest_MoveConstructor(): map(make_unique_ref>()) { CopyableMovableValueType::numCopyConstructorCalled = 0; - map = make_unique>(); } - unique_ptr> map; + unique_ref> map; }; TEST_F(QueueMapTest_MoveConstructor, PushingAndPopping_MoveIntoMap) { diff --git a/test/implementations/caching/cache/testutils/QueueMapTest.cpp b/test/implementations/caching/cache/testutils/QueueMapTest.cpp index f61b41a3..76fae6fe 100644 --- a/test/implementations/caching/cache/testutils/QueueMapTest.cpp +++ b/test/implementations/caching/cache/testutils/QueueMapTest.cpp @@ -1,13 +1,12 @@ #include "QueueMapTest.h" -QueueMapTest::QueueMapTest() { +QueueMapTest::QueueMapTest(): _map(cpputils::make_unique_ref>()) { MinimalKeyType::instances = 0; MinimalValueType::instances = 0; - _map = std::make_unique>(); } QueueMapTest::~QueueMapTest() { - _map.reset(); + cpputils::destruct(std::move(_map)); EXPECT_EQ(0, MinimalKeyType::instances); EXPECT_EQ(0, MinimalValueType::instances); } diff --git a/test/implementations/caching/cache/testutils/QueueMapTest.h b/test/implementations/caching/cache/testutils/QueueMapTest.h index e49ad93f..15cd97b9 100644 --- a/test/implementations/caching/cache/testutils/QueueMapTest.h +++ b/test/implementations/caching/cache/testutils/QueueMapTest.h @@ -3,7 +3,7 @@ #define BLOCKS_MESSMER_BLOCKSTORE_TEST_IMPLEMENTATIONS_CACHING_CACHE_TESTUTILS_QUEUEMAPTEST_H_ #include -#include +#include #include "../../../../../implementations/caching/cache/QueueMap.h" #include "MinimalKeyType.h" #include "MinimalValueType.h" @@ -24,9 +24,8 @@ public: int size(); private: - std::unique_ptr> _map; + cpputils::unique_ref> _map; }; - #endif diff --git a/test/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp b/test/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp index 5507151d..a72ab547 100644 --- a/test/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp +++ b/test/implementations/encrypted/EncryptedBlockStoreTest_Generic.cpp @@ -15,17 +15,16 @@ using blockstore::testfake::FakeBlockStore; using blockstore::encrypted::AES256_GCM; using blockstore::encrypted::AES256_CFB; -using std::unique_ptr; -using std::make_unique; - using cpputils::Data; using cpputils::DataFixture; +using cpputils::make_unique_ref; +using cpputils::unique_ref; template class EncryptedBlockStoreTestFixture: public BlockStoreTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique>(make_unique(), createKeyFixture()); + unique_ref createBlockStore() override { + return make_unique_ref>(make_unique_ref(), createKeyFixture()); } private: diff --git a/test/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp b/test/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp index 937ea43c..b293d78c 100644 --- a/test/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp +++ b/test/implementations/encrypted/EncryptedBlockStoreTest_Specific.cpp @@ -7,11 +7,10 @@ using ::testing::Test; -using std::unique_ptr; -using std::make_unique; - using cpputils::DataFixture; using cpputils::Data; +using cpputils::unique_ref; +using cpputils::make_unique_ref; using blockstore::testfake::FakeBlockStore; @@ -21,14 +20,12 @@ class EncryptedBlockStoreTest: public Test { public: static constexpr unsigned int BLOCKSIZE = 1024; EncryptedBlockStoreTest(): - _baseBlockStore(make_unique()), - baseBlockStore(_baseBlockStore.get()), - blockStore(make_unique>(std::move(_baseBlockStore), FakeAuthenticatedCipher::Key1())), + baseBlockStore(new FakeBlockStore), + blockStore(make_unique_ref>(std::move(cpputils::nullcheck(std::unique_ptr(baseBlockStore)).value()), FakeAuthenticatedCipher::Key1())), data(DataFixture::generate(BLOCKSIZE)) { } - unique_ptr _baseBlockStore; FakeBlockStore *baseBlockStore; - unique_ptr> blockStore; + unique_ref> blockStore; Data data; blockstore::Key CreateBlockDirectlyWithFixtureAndReturnKey() { diff --git a/test/implementations/inmemory/InMemoryBlockStoreTest.cpp b/test/implementations/inmemory/InMemoryBlockStoreTest.cpp index b8dfa8e8..6c4c1fe5 100644 --- a/test/implementations/inmemory/InMemoryBlockStoreTest.cpp +++ b/test/implementations/inmemory/InMemoryBlockStoreTest.cpp @@ -9,14 +9,13 @@ using blockstore::BlockStore; using blockstore::BlockStoreWithRandomKeys; using blockstore::inmemory::InMemoryBlockStore; - -using std::unique_ptr; -using std::make_unique; +using cpputils::unique_ref; +using cpputils::make_unique_ref; class InMemoryBlockStoreTestFixture: public BlockStoreTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(); + unique_ref createBlockStore() override { + return make_unique_ref(); } }; @@ -24,8 +23,8 @@ INSTANTIATE_TYPED_TEST_CASE_P(InMemory, BlockStoreTest, InMemoryBlockStoreTestFi class InMemoryBlockStoreWithRandomKeysTestFixture: public BlockStoreWithRandomKeysTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(); + unique_ref createBlockStore() override { + return make_unique_ref(); } }; diff --git a/test/implementations/ondisk/OnDiskBlockStoreTest.cpp b/test/implementations/ondisk/OnDiskBlockStoreTest.cpp index 884e5516..69a89da9 100644 --- a/test/implementations/ondisk/OnDiskBlockStoreTest.cpp +++ b/test/implementations/ondisk/OnDiskBlockStoreTest.cpp @@ -11,15 +11,14 @@ using blockstore::BlockStore; using blockstore::BlockStoreWithRandomKeys; using blockstore::ondisk::OnDiskBlockStore; -using std::unique_ptr; -using std::make_unique; - using cpputils::TempDir; +using cpputils::unique_ref; +using cpputils::make_unique_ref; class OnDiskBlockStoreTestFixture: public BlockStoreTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(tempdir.path()); + unique_ref createBlockStore() override { + return make_unique_ref(tempdir.path()); } private: TempDir tempdir; @@ -29,8 +28,8 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnDisk, BlockStoreTest, OnDiskBlockStoreTestFixtur class OnDiskBlockStoreWithRandomKeysTestFixture: public BlockStoreWithRandomKeysTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(tempdir.path()); + unique_ref createBlockStore() override { + return make_unique_ref(tempdir.path()); } private: TempDir tempdir; diff --git a/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockCreateTest.cpp b/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockCreateTest.cpp index 2635f88e..06b5556a 100644 --- a/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockCreateTest.cpp +++ b/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockCreateTest.cpp @@ -7,8 +7,6 @@ using ::testing::Test; using ::testing::WithParamInterface; using ::testing::Values; - -using std::unique_ptr; using cpputils::Data; using cpputils::TempFile; using cpputils::TempDir; diff --git a/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockFlushTest.cpp b/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockFlushTest.cpp index 4af0335b..619924b2 100644 --- a/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockFlushTest.cpp +++ b/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockFlushTest.cpp @@ -9,7 +9,6 @@ using ::testing::Test; using ::testing::WithParamInterface; using ::testing::Values; -using std::unique_ptr; using cpputils::Data; using cpputils::DataFixture; using cpputils::TempFile; diff --git a/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockLoadTest.cpp b/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockLoadTest.cpp index 5d564df6..1dc00625 100644 --- a/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockLoadTest.cpp +++ b/test/implementations/ondisk/OnDiskBlockTest/OnDiskBlockLoadTest.cpp @@ -14,7 +14,6 @@ using ::testing::WithParamInterface; using ::testing::Values; using std::ofstream; -using std::unique_ptr; using std::ios; using cpputils::Data; using cpputils::DataFixture; diff --git a/test/implementations/parallelaccess/ParallelAccessBlockStoreTest.cpp b/test/implementations/parallelaccess/ParallelAccessBlockStoreTest.cpp index f94d426d..c3647a1e 100644 --- a/test/implementations/parallelaccess/ParallelAccessBlockStoreTest.cpp +++ b/test/implementations/parallelaccess/ParallelAccessBlockStoreTest.cpp @@ -8,14 +8,13 @@ using blockstore::BlockStore; using blockstore::parallelaccess::ParallelAccessBlockStore; using blockstore::testfake::FakeBlockStore; -using std::unique_ptr; -using std::make_unique; using cpputils::make_unique_ref; +using cpputils::unique_ref; class ParallelAccessBlockStoreTestFixture: public BlockStoreTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(make_unique_ref()); + unique_ref createBlockStore() override { + return make_unique_ref(make_unique_ref()); } }; diff --git a/test/implementations/testfake/TestFakeBlockStoreTest.cpp b/test/implementations/testfake/TestFakeBlockStoreTest.cpp index f671bed5..55e04577 100644 --- a/test/implementations/testfake/TestFakeBlockStoreTest.cpp +++ b/test/implementations/testfake/TestFakeBlockStoreTest.cpp @@ -8,14 +8,13 @@ using blockstore::BlockStore; using blockstore::BlockStoreWithRandomKeys; using blockstore::testfake::FakeBlockStore; - -using std::unique_ptr; -using std::make_unique; +using cpputils::unique_ref; +using cpputils::make_unique_ref; class FakeBlockStoreTestFixture: public BlockStoreTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(); + unique_ref createBlockStore() override { + return make_unique_ref(); } }; @@ -23,8 +22,8 @@ INSTANTIATE_TYPED_TEST_CASE_P(TestFake, BlockStoreTest, FakeBlockStoreTestFixtur class FakeBlockStoreWithRandomKeysTestFixture: public BlockStoreWithRandomKeysTestFixture { public: - unique_ptr createBlockStore() override { - return make_unique(); + unique_ref createBlockStore() override { + return make_unique_ref(); } }; diff --git a/test/interface/helpers/BlockStoreWithRandomKeysTest.cpp b/test/interface/helpers/BlockStoreWithRandomKeysTest.cpp index e71a8354..c3e3b05e 100644 --- a/test/interface/helpers/BlockStoreWithRandomKeysTest.cpp +++ b/test/interface/helpers/BlockStoreWithRandomKeysTest.cpp @@ -11,8 +11,6 @@ using ::testing::Eq; using ::testing::ByRef; using std::string; -using std::unique_ptr; -using std::make_unique; using cpputils::Data; using cpputils::DataFixture; using cpputils::unique_ref; @@ -23,11 +21,11 @@ using namespace blockstore; class BlockStoreWithRandomKeysMock: public BlockStoreWithRandomKeys { public: optional> tryCreate(const Key &key, Data data) { - return cpputils::nullcheck(unique_ptr(do_create(key, data))); + return cpputils::nullcheck(std::unique_ptr(do_create(key, data))); } MOCK_METHOD2(do_create, Block*(const Key &, const Data &data)); optional> load(const Key &key) { - return cpputils::nullcheck(unique_ptr(do_load(key))); + return cpputils::nullcheck(std::unique_ptr(do_load(key))); } MOCK_METHOD1(do_load, Block*(const Key &)); void remove(unique_ref block) {UNUSED(block);} diff --git a/test/testutils/BlockStoreTest.h b/test/testutils/BlockStoreTest.h index 43923dfd..0ab01fd8 100644 --- a/test/testutils/BlockStoreTest.h +++ b/test/testutils/BlockStoreTest.h @@ -8,7 +8,7 @@ class BlockStoreTestFixture { public: - virtual std::unique_ptr createBlockStore() = 0; + virtual cpputils::unique_ref createBlockStore() = 0; }; template diff --git a/test/testutils/BlockStoreTest_Data.h b/test/testutils/BlockStoreTest_Data.h index cdb40842..aeedb96e 100644 --- a/test/testutils/BlockStoreTest_Data.h +++ b/test/testutils/BlockStoreTest_Data.h @@ -8,7 +8,7 @@ struct DataRange { class BlockStoreDataParametrizedTest { public: - BlockStoreDataParametrizedTest(std::unique_ptr blockStore_, const DataRange &testData_) + BlockStoreDataParametrizedTest(cpputils::unique_ref blockStore_, const DataRange &testData_) : blockStore(std::move(blockStore_)), testData(testData_), foregroundData(cpputils::DataFixture::generate(testData.count, 0)), @@ -40,7 +40,7 @@ public: } private: - std::unique_ptr blockStore; + cpputils::unique_ref blockStore; DataRange testData; cpputils::Data foregroundData; cpputils::Data backgroundData; diff --git a/test/testutils/BlockStoreTest_Size.h b/test/testutils/BlockStoreTest_Size.h index 0cbfddb0..536a82fa 100644 --- a/test/testutils/BlockStoreTest_Size.h +++ b/test/testutils/BlockStoreTest_Size.h @@ -5,7 +5,7 @@ class BlockStoreSizeParameterizedTest { public: - BlockStoreSizeParameterizedTest(std::unique_ptr blockStore_, size_t size_): blockStore(std::move(blockStore_)), size(size_) {} + BlockStoreSizeParameterizedTest(cpputils::unique_ref blockStore_, size_t size_): blockStore(std::move(blockStore_)), size(size_) {} void TestCreatedBlockHasCorrectSize() { auto block = CreateBlock(); @@ -93,7 +93,7 @@ public: private: const blockstore::Key key = blockstore::Key::FromString("1491BB4932A389EE14BC7090AC772972"); - std::unique_ptr blockStore; + cpputils::unique_ref blockStore; size_t size; cpputils::Data ZEROES(size_t size) { diff --git a/test/testutils/BlockStoreWithRandomKeysTest.h b/test/testutils/BlockStoreWithRandomKeysTest.h index 8ea57da6..1279785e 100644 --- a/test/testutils/BlockStoreWithRandomKeysTest.h +++ b/test/testutils/BlockStoreWithRandomKeysTest.h @@ -8,7 +8,7 @@ class BlockStoreWithRandomKeysTestFixture { public: - virtual std::unique_ptr createBlockStore() = 0; + virtual cpputils::unique_ref createBlockStore() = 0; }; template diff --git a/test/utils/BlockStoreUtilsTest.cpp b/test/utils/BlockStoreUtilsTest.cpp index adc72ad8..ecd5c610 100644 --- a/test/utils/BlockStoreUtilsTest.cpp +++ b/test/utils/BlockStoreUtilsTest.cpp @@ -9,10 +9,10 @@ using ::testing::Test; using ::testing::WithParamInterface; using ::testing::Values; -using std::make_unique; -using std::unique_ptr; using cpputils::Data; using cpputils::DataFixture; +using cpputils::unique_ref; +using cpputils::make_unique_ref; using namespace blockstore; using namespace blockstore::utils; @@ -25,13 +25,13 @@ public: BlockStoreUtilsTest(): ZEROES(SIZE), dataFixture(DataFixture::generate(SIZE)), - blockStore(make_unique()) { + blockStore(make_unique_ref()) { ZEROES.FillWithZeroes(); } Data ZEROES; Data dataFixture; - unique_ptr blockStore; + unique_ref blockStore; }; TEST_F(BlockStoreUtilsTest, FillWithZeroes) {