libcryfs/test/blockstore/implementations/ondisk/OnDiskBlockStoreTest_Generic.cpp

60 lines
1.8 KiB
C++
Raw Normal View History

#include "blockstore/implementations/ondisk/OnDiskBlock.h"
#include "blockstore/implementations/ondisk/OnDiskBlockStore.h"
#include "blockstore/implementations/ondisk/OnDiskBlockStore2.h"
#include "../../testutils/BlockStoreTest.h"
#include "../../testutils/BlockStore2Test.h"
#include "../../testutils/BlockStoreWithRandomKeysTest.h"
#include <gtest/gtest.h>
2015-02-17 00:23:33 +01:00
#include <cpp-utils/tempfile/TempDir.h>
2014-12-09 17:19:59 +01:00
using blockstore::BlockStore;
using blockstore::BlockStoreWithRandomKeys;
using blockstore::ondisk::OnDiskBlockStore;
using blockstore::BlockStore2;
using blockstore::ondisk::OnDiskBlockStore2;
2014-12-09 17:19:59 +01:00
2015-04-25 03:47:03 +02:00
using cpputils::TempDir;
using cpputils::unique_ref;
using cpputils::make_unique_ref;
2015-02-17 00:23:33 +01:00
2014-12-09 17:19:59 +01:00
class OnDiskBlockStoreTestFixture: public BlockStoreTestFixture {
public:
2015-10-17 21:10:26 +02:00
OnDiskBlockStoreTestFixture(): tempdir() {}
unique_ref<BlockStore> createBlockStore() override {
return make_unique_ref<OnDiskBlockStore>(tempdir.path());
2014-12-09 17:19:59 +01:00
}
private:
TempDir tempdir;
};
INSTANTIATE_TYPED_TEST_CASE_P(OnDisk, BlockStoreTest, OnDiskBlockStoreTestFixture);
class OnDiskBlockStoreWithRandomKeysTestFixture: public BlockStoreWithRandomKeysTestFixture {
public:
2015-10-17 21:10:26 +02:00
OnDiskBlockStoreWithRandomKeysTestFixture(): tempdir() {}
unique_ref<BlockStoreWithRandomKeys> createBlockStore() override {
return make_unique_ref<OnDiskBlockStore>(tempdir.path());
2014-12-09 17:19:59 +01:00
}
private:
TempDir tempdir;
};
INSTANTIATE_TYPED_TEST_CASE_P(OnDisk, BlockStoreWithRandomKeysTest, OnDiskBlockStoreWithRandomKeysTestFixture);
class OnDiskBlockStore2TestFixture: public BlockStore2TestFixture {
public:
OnDiskBlockStore2TestFixture(): tempdir() {}
unique_ref<BlockStore2> createBlockStore() override {
return make_unique_ref<OnDiskBlockStore2>(tempdir.path());
}
private:
TempDir tempdir;
};
INSTANTIATE_TYPED_TEST_CASE_P(OnDisk, BlockStore2Test, OnDiskBlockStore2TestFixture);