- run-clang-tidy.sh also runs on test cases.

- fix clang-tidy warnings in test cases
This commit is contained in:
Sebastian Messmer 2017-12-01 15:01:49 +00:00
parent 006d8b541a
commit cc7b38b3c1
101 changed files with 47 additions and 231 deletions

View File

@ -11,7 +11,10 @@ set -e
NUMCORES=`nproc` NUMCORES=`nproc`
# Run cmake in current working directory, but on source that is in the same directory as this script file # Run cmake in current working directory, but on source that is in the same directory as this script file
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${0%/*}" cmake -DBUILD_TESTING=on -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "${0%/*}"
# Build scrypt first. Our Makefiles call ino theirs, and this is needed to generate some header files. Clang-tidy will otherwise complain they're missing.
make -j${NUMCORES} scrypt
run-clang-tidy.py -j${NUMCORES} -quiet -header-filter "$(realpath ${0%/*})/(src|test)/.*" $@ run-clang-tidy.py -j${NUMCORES} -quiet -header-filter "$(realpath ${0%/*})/(src|test)/.*" $@

View File

@ -9,6 +9,8 @@ namespace blockstore {
namespace integrity { namespace integrity {
struct ClientIdAndBlockId final { struct ClientIdAndBlockId final {
ClientIdAndBlockId(uint32_t clientId_, BlockId blockId_): clientId(clientId_), blockId(blockId_) {}
uint32_t clientId; uint32_t clientId;
BlockId blockId; BlockId blockId;
}; };

View File

@ -2,6 +2,7 @@ project (cpp-utils)
set(SOURCES set(SOURCES
crypto/symmetric/ciphers.cpp crypto/symmetric/ciphers.cpp
crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp
crypto/kdf/Scrypt.cpp crypto/kdf/Scrypt.cpp
crypto/kdf/SCryptParameters.cpp crypto/kdf/SCryptParameters.cpp
crypto/kdf/PasswordBasedKDF.cpp crypto/kdf/PasswordBasedKDF.cpp

View File

@ -2,4 +2,6 @@
namespace cpputils { namespace cpputils {
constexpr unsigned int FakeKey::BINARY_LENGTH; constexpr unsigned int FakeKey::BINARY_LENGTH;
std::random_device FakeAuthenticatedCipher::random_;
} }

View File

@ -7,6 +7,7 @@
#include "cpp-utils/data/FixedSizeData.h" #include "cpp-utils/data/FixedSizeData.h"
#include "cpp-utils/data/Data.h" #include "cpp-utils/data/Data.h"
#include "cpp-utils/random/RandomGenerator.h" #include "cpp-utils/random/RandomGenerator.h"
#include <random>
namespace cpputils { namespace cpputils {
@ -52,7 +53,7 @@ namespace cpputils {
Data result(ciphertextSize(plaintextSize)); Data result(ciphertextSize(plaintextSize));
//Add a random IV //Add a random IV
uint8_t iv = rand(); uint8_t iv = std::uniform_int_distribution<uint8_t>()(random_);
std::memcpy(result.data(), &iv, 1); std::memcpy(result.data(), &iv, 1);
//Use caesar chiffre on plaintext //Use caesar chiffre on plaintext
@ -108,6 +109,8 @@ namespace cpputils {
dst[i] = src[i] + key; dst[i] = src[i] + key;
} }
} }
static std::random_device random_;
}; };
} }

View File

@ -16,7 +16,7 @@ public:
} }
void Test_Load_While_Not_Loaded() { void Test_Load_While_Not_Loaded() {
struct stat oldStat; struct stat oldStat{};
{ {
auto node = this->CreateNode("/mynode"); auto node = this->CreateNode("/mynode");
oldStat = this->stat(*node); oldStat = this->stat(*node);

View File

@ -48,11 +48,11 @@ public:
}; };
TYPED_TEST_CASE_P(FsppDirTest); TYPED_TEST_CASE_P(FsppDirTest);
fspp::Dir::Entry DirEntry(const std::string &name) { inline fspp::Dir::Entry DirEntry(const std::string &name) {
return fspp::Dir::Entry(fspp::Dir::EntryType::DIR, name); return fspp::Dir::Entry(fspp::Dir::EntryType::DIR, name);
} }
fspp::Dir::Entry FileEntry(const std::string &name) { inline fspp::Dir::Entry FileEntry(const std::string &name) {
return fspp::Dir::Entry(fspp::Dir::EntryType::FILE, name); return fspp::Dir::Entry(fspp::Dir::EntryType::FILE, name);
} }

View File

@ -79,8 +79,8 @@ public:
} }
void Test_Utimens(fspp::File *file, fspp::Node *node) { void Test_Utimens(fspp::File *file, fspp::Node *node) {
struct timespec ATIME; ATIME.tv_sec = 1458086400; ATIME.tv_nsec = 34525; struct timespec ATIME{}; ATIME.tv_sec = 1458086400; ATIME.tv_nsec = 34525;
struct timespec MTIME; MTIME.tv_sec = 1458086300; MTIME.tv_nsec = 48293; struct timespec MTIME{}; MTIME.tv_sec = 1458086300; MTIME.tv_nsec = 48293;
node->utimens(ATIME, MTIME); node->utimens(ATIME, MTIME);
this->IN_STAT(file, node, [this, ATIME, MTIME] (struct stat st) { this->IN_STAT(file, node, [this, ATIME, MTIME] (struct stat st) {
this->EXPECT_ATIME_EQ(ATIME, st); this->EXPECT_ATIME_EQ(ATIME, st);

View File

@ -26,7 +26,7 @@ public:
void Test_Stat() { void Test_Stat() {
auto node = this->CreateNode("/mynode"); auto node = this->CreateNode("/mynode");
auto operation = [&node] () { auto operation = [&node] () {
struct stat st; struct stat st{};
node->stat(&st); node->stat(&st);
}; };
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, { this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS("/mynode", operation, {

View File

@ -8,7 +8,7 @@ template<class ConcreteFileSystemTestFixture>
class FsppOpenFileTest: public FileSystemTest<ConcreteFileSystemTestFixture> { class FsppOpenFileTest: public FileSystemTest<ConcreteFileSystemTestFixture> {
public: public:
void IN_STAT(fspp::OpenFile *openFile, std::function<void (struct stat)> callback) { void IN_STAT(fspp::OpenFile *openFile, std::function<void (struct stat)> callback) {
struct stat st; struct stat st{};
openFile->stat(&st); openFile->stat(&st);
callback(st); callback(st);
} }

View File

@ -24,7 +24,7 @@ TYPED_TEST_CASE_P(FsppOpenFileTest_Timestamps);
TYPED_TEST_P(FsppOpenFileTest_Timestamps, stat) { TYPED_TEST_P(FsppOpenFileTest_Timestamps, stat) {
auto openFile = this->CreateAndOpenFile("/mynode"); auto openFile = this->CreateAndOpenFile("/mynode");
auto operation = [&openFile] () { auto operation = [&openFile] () {
struct ::stat st; struct ::stat st{};
openFile->stat(&st); openFile->stat(&st);
}; };
this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectDoesntUpdateAnyTimestamps}); this->EXPECT_OPERATION_UPDATES_TIMESTAMPS_AS(*openFile, operation, {this->ExpectDoesntUpdateAnyTimestamps});

View File

@ -90,7 +90,7 @@ public:
void setModificationTimestampLaterThanAccessTimestamp(const boost::filesystem::path& path) { void setModificationTimestampLaterThanAccessTimestamp(const boost::filesystem::path& path) {
auto node = device->Load(path).value(); auto node = device->Load(path).value();
struct stat st; struct stat st{};
node->stat(&st); node->stat(&st);
st.st_mtim.tv_nsec = st.st_mtim.tv_nsec + 1; st.st_mtim.tv_nsec = st.st_mtim.tv_nsec + 1;
node->utimens( node->utimens(

View File

@ -29,7 +29,7 @@ public:
//TODO IN_STAT still needed after moving it to FsppNodeTest? //TODO IN_STAT still needed after moving it to FsppNodeTest?
void IN_STAT(fspp::File *file, fspp::Node *node, std::function<void (struct stat)> callback) { void IN_STAT(fspp::File *file, fspp::Node *node, std::function<void (struct stat)> callback) {
struct stat st1, st2; struct stat st1{}, st2{};
node->stat(&st1); node->stat(&st1);
callback(st1); callback(st1);
file->open(O_RDONLY)->stat(&st2); file->open(O_RDONLY)->stat(&st2);

View File

@ -10,7 +10,7 @@
class FsppNodeTestHelper { class FsppNodeTestHelper {
public: public:
void IN_STAT(fspp::Node *file, std::function<void (struct stat)> callback) { void IN_STAT(fspp::Node *file, std::function<void (struct stat)> callback) {
struct stat st; struct stat st{};
file->stat(&st); file->stat(&st);
callback(st); callback(st);
} }

View File

@ -70,13 +70,13 @@ public:
} }
static struct stat stat(const fspp::Node &node) { static struct stat stat(const fspp::Node &node) {
struct stat st; struct stat st{};
node.stat(&st); node.stat(&st);
return st; return st;
} }
static struct stat stat(const fspp::OpenFile &openFile) { static struct stat stat(const fspp::OpenFile &openFile) {
struct stat st; struct stat st{};
openFile.stat(&st); openFile.stat(&st);
return st; return st;
} }

View File

@ -2,8 +2,6 @@
#include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h> #include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h>
using blockstore::BlockId; using blockstore::BlockId;
using cpputils::unique_ref;
using blobstore::Blob;
using boost::none; using boost::none;
TEST_F(BlobStoreTest, LoadNonexistingKeyOnEmptyBlobstore) { TEST_F(BlobStoreTest, LoadNonexistingKeyOnEmptyBlobstore) {

View File

@ -13,7 +13,6 @@
using ::testing::Test; using ::testing::Test;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Combine;
using cpputils::unique_ref; using cpputils::unique_ref;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using std::string; using std::string;

View File

@ -5,9 +5,7 @@
#include <blockstore/implementations/testfake/FakeBlockStore.h> #include <blockstore/implementations/testfake/FakeBlockStore.h>
#include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h> #include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h>
using blockstore::testfake::FakeBlockStore;
using blockstore::BlockId; using blockstore::BlockId;
using blobstore::onblocks::datanodestore::DataNodeStore;
using boost::none; using boost::none;
using namespace blobstore::onblocks::datatreestore; using namespace blobstore::onblocks::datatreestore;

View File

@ -1,15 +1,10 @@
#include "testutils/DataTreeTest.h" #include "testutils/DataTreeTest.h"
#include <gmock/gmock.h> #include <gmock/gmock.h>
using ::testing::_;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using blobstore::onblocks::datanodestore::DataLeafNode;
using blobstore::onblocks::datanodestore::DataInnerNode;
using blobstore::onblocks::datanodestore::DataNode;
using blobstore::onblocks::datanodestore::DataNodeLayout; using blobstore::onblocks::datanodestore::DataNodeLayout;
using blobstore::onblocks::datatreestore::DataTree;
using blockstore::BlockId; using blockstore::BlockId;
class DataTreeTest_NumStoredBytes: public DataTreeTest { class DataTreeTest_NumStoredBytes: public DataTreeTest {

View File

@ -2,16 +2,10 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
using blobstore::onblocks::datanodestore::DataNodeStore;
using blobstore::onblocks::datanodestore::DataLeafNode;
using blobstore::onblocks::datanodestore::DataInnerNode;
using blobstore::onblocks::datanodestore::DataNode;
using blobstore::onblocks::datatreestore::DataTree; using blobstore::onblocks::datatreestore::DataTree;
using blobstore::onblocks::datatreestore::LeafHandle; using blobstore::onblocks::datatreestore::LeafHandle;
using blockstore::BlockId; using blockstore::BlockId;
using blockstore::testfake::FakeBlockStore;
using cpputils::Data; using cpputils::Data;
using cpputils::make_unique_ref;
class DataTreeTest_Performance: public DataTreeTest { class DataTreeTest_Performance: public DataTreeTest {
public: public:

View File

@ -8,7 +8,6 @@ using ::testing::Eq;
using blobstore::onblocks::datanodestore::DataLeafNode; using blobstore::onblocks::datanodestore::DataLeafNode;
using blobstore::onblocks::datanodestore::DataInnerNode; using blobstore::onblocks::datanodestore::DataInnerNode;
using blobstore::onblocks::datanodestore::DataNode; using blobstore::onblocks::datanodestore::DataNode;
using blobstore::onblocks::datatreestore::DataTree;
using blobstore::onblocks::datatreestore::LeafHandle; using blobstore::onblocks::datatreestore::LeafHandle;
using blockstore::BlockId; using blockstore::BlockId;

View File

@ -7,14 +7,7 @@
#include <blockstore/implementations/testfake/FakeBlockStore.h> #include <blockstore/implementations/testfake/FakeBlockStore.h>
#include "blobstore/implementations/onblocks/datatreestore/impl/algorithms.h" #include "blobstore/implementations/onblocks/datatreestore/impl/algorithms.h"
using ::testing::Test;
using std::pair;
using std::make_pair;
using blobstore::onblocks::datanodestore::DataNodeStore;
using blobstore::onblocks::datanodestore::DataNode;
using blobstore::onblocks::datanodestore::DataInnerNode;
using blockstore::testfake::FakeBlockStore;
using blockstore::BlockId; using blockstore::BlockId;
using cpputils::Data; using cpputils::Data;
using namespace blobstore::onblocks::datatreestore::algorithms; using namespace blobstore::onblocks::datatreestore::algorithms;

View File

@ -7,14 +7,7 @@
#include <blockstore/implementations/testfake/FakeBlockStore.h> #include <blockstore/implementations/testfake/FakeBlockStore.h>
#include "blobstore/implementations/onblocks/datatreestore/impl/algorithms.h" #include "blobstore/implementations/onblocks/datatreestore/impl/algorithms.h"
using ::testing::Test;
using std::pair;
using std::make_pair;
using blobstore::onblocks::datanodestore::DataNodeStore;
using blobstore::onblocks::datanodestore::DataNode;
using blobstore::onblocks::datanodestore::DataInnerNode;
using blockstore::testfake::FakeBlockStore;
using blockstore::BlockId; using blockstore::BlockId;
using namespace blobstore::onblocks::datatreestore::algorithms; using namespace blobstore::onblocks::datatreestore::algorithms;

View File

@ -5,7 +5,6 @@
#include "../../testutils/BlockStore2Test.h" #include "../../testutils/BlockStore2Test.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using ::testing::Test;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::BlockStore2; using blockstore::BlockStore2;
@ -13,8 +12,6 @@ using blockstore::caching::CachingBlockStore2;
using blockstore::lowtohighlevel::LowToHighLevelBlockStore; using blockstore::lowtohighlevel::LowToHighLevelBlockStore;
using blockstore::inmemory::InMemoryBlockStore2; using blockstore::inmemory::InMemoryBlockStore2;
using cpputils::Data;
using cpputils::DataFixture;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using cpputils::unique_ref; using cpputils::unique_ref;

View File

@ -5,8 +5,6 @@
using ::testing::Test; using ::testing::Test;
using cpputils::Data; using cpputils::Data;
using cpputils::unique_ref;
using cpputils::make_unique_ref;
using blockstore::inmemory::InMemoryBlockStore2; using blockstore::inmemory::InMemoryBlockStore2;

View File

@ -5,7 +5,6 @@
#include "testutils/MinimalValueType.h" #include "testutils/MinimalValueType.h"
#include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h> #include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h>
using ::testing::Test;
using namespace blockstore::caching; using namespace blockstore::caching;

View File

@ -14,10 +14,10 @@ public:
++numCopyConstructorCalled; ++numCopyConstructorCalled;
return *this; return *this;
} }
CopyableMovableValueType(CopyableMovableValueType &&rhs): CopyableMovableValueType(rhs._value) { CopyableMovableValueType(CopyableMovableValueType &&rhs) noexcept: CopyableMovableValueType(rhs._value) {
//Don't increase numCopyConstructorCalled //Don't increase numCopyConstructorCalled
} }
CopyableMovableValueType &operator=(CopyableMovableValueType &&rhs) { CopyableMovableValueType &operator=(CopyableMovableValueType &&rhs) noexcept {
//Don't increase numCopyConstructorCalled //Don't increase numCopyConstructorCalled
_value = rhs._value; _value = rhs._value;
return *this; return *this;

View File

@ -15,11 +15,11 @@ public:
return MinimalValueType(value); return MinimalValueType(value);
} }
MinimalValueType(MinimalValueType &&rhs): MinimalValueType(rhs.value()) { MinimalValueType(MinimalValueType &&rhs) noexcept: MinimalValueType(rhs.value()) {
rhs._isMoved = true; rhs._isMoved = true;
} }
MinimalValueType &operator=(MinimalValueType &&rhs) { MinimalValueType &operator=(MinimalValueType &&rhs) noexcept {
_value = rhs.value(); _value = rhs.value();
_isMoved = false; _isMoved = false;
rhs._isMoved = true; rhs._isMoved = true;

View File

@ -5,7 +5,6 @@
#include "../../testutils/BlockStoreTest.h" #include "../../testutils/BlockStoreTest.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using ::testing::Test;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::compressing::CompressingBlockStore; using blockstore::compressing::CompressingBlockStore;

View File

@ -7,10 +7,9 @@
#include "../../testutils/BlockStoreTest.h" #include "../../testutils/BlockStoreTest.h"
#include "../../testutils/BlockStore2Test.h" #include "../../testutils/BlockStore2Test.h"
//TODO Move FakeAuthenticatedCipher out of test folder to normal folder. Dependencies should not point into tests of other modules. //TODO Move FakeAuthenticatedCipher out of test folder to normal folder. Dependencies should not point into tests of other modules.
#include "../../../cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" #include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using ::testing::Test;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::BlockStore2; using blockstore::BlockStore2;

View File

@ -1,6 +1,6 @@
#include "cpp-utils/crypto/cryptopp_byte.h" #include "cpp-utils/crypto/cryptopp_byte.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "../../../cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h" #include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h"
#include "blockstore/implementations/encrypted/EncryptedBlockStore2.h" #include "blockstore/implementations/encrypted/EncryptedBlockStore2.h"
#include "blockstore/implementations/inmemory/InMemoryBlockStore2.h" #include "blockstore/implementations/inmemory/InMemoryBlockStore2.h"
#include "blockstore/utils/BlockStoreUtils.h" #include "blockstore/utils/BlockStoreUtils.h"
@ -54,7 +54,7 @@ public:
blockstore::BlockId CopyBaseBlock(const blockstore::BlockId &blockId) { blockstore::BlockId CopyBaseBlock(const blockstore::BlockId &blockId) {
auto source = baseBlockStore->load(blockId).value(); auto source = baseBlockStore->load(blockId).value();
return baseBlockStore->create(std::move(source)); return baseBlockStore->create(source);
} }
private: private:

View File

@ -6,17 +6,13 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cpp-utils/tempfile/TempFile.h> #include <cpp-utils/tempfile/TempFile.h>
using ::testing::Test;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::BlockStore2; using blockstore::BlockStore2;
using blockstore::integrity::IntegrityBlockStore2; using blockstore::integrity::IntegrityBlockStore2;
using blockstore::integrity::KnownBlockVersions;
using blockstore::lowtohighlevel::LowToHighLevelBlockStore; using blockstore::lowtohighlevel::LowToHighLevelBlockStore;
using blockstore::inmemory::InMemoryBlockStore2; using blockstore::inmemory::InMemoryBlockStore2;
using cpputils::Data;
using cpputils::DataFixture;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using cpputils::unique_ref; using cpputils::unique_ref;
using cpputils::TempFile; using cpputils::TempFile;

View File

@ -102,7 +102,7 @@ public:
} }
void insertBaseBlock(const blockstore::BlockId &blockId, Data data) { void insertBaseBlock(const blockstore::BlockId &blockId, Data data) {
EXPECT_TRUE(baseBlockStore->tryCreate(blockId, std::move(data))); EXPECT_TRUE(baseBlockStore->tryCreate(blockId, data));
} }
private: private:

View File

@ -5,19 +5,13 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cpp-utils/tempfile/TempFile.h> #include <cpp-utils/tempfile/TempFile.h>
using ::testing::Test;
using blockstore::BlockStore; using blockstore::BlockStore;
using blockstore::BlockStore2;
using blockstore::lowtohighlevel::LowToHighLevelBlockStore; using blockstore::lowtohighlevel::LowToHighLevelBlockStore;
using blockstore::testfake::FakeBlockStore;
using blockstore::inmemory::InMemoryBlockStore2; using blockstore::inmemory::InMemoryBlockStore2;
using cpputils::Data;
using cpputils::DataFixture;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using cpputils::unique_ref; using cpputils::unique_ref;
using cpputils::TempFile;
class LowToHighLevelBlockStoreTestFixture: public BlockStoreTestFixture { class LowToHighLevelBlockStoreTestFixture: public BlockStoreTestFixture {
public: public:

View File

@ -5,8 +5,6 @@
using ::testing::Test; using ::testing::Test;
using cpputils::Data; using cpputils::Data;
using cpputils::unique_ref;
using cpputils::make_unique_ref;
using blockstore::testfake::FakeBlockStore; using blockstore::testfake::FakeBlockStore;

View File

@ -13,7 +13,6 @@ using ::testing::ByRef;
using std::string; using std::string;
using cpputils::Data; using cpputils::Data;
using cpputils::DataFixture; using cpputils::DataFixture;
using cpputils::unique_ref;
using boost::optional; using boost::optional;
namespace boost { namespace boost {

View File

@ -6,8 +6,6 @@
#include <memory> #include <memory>
using ::testing::Test; using ::testing::Test;
using ::testing::WithParamInterface;
using ::testing::Values;
using cpputils::Data; using cpputils::Data;
using cpputils::DataFixture; using cpputils::DataFixture;

View File

@ -1,9 +1,7 @@
project (cpp-utils-test) project (cpp-utils-test)
set(SOURCES set(SOURCES
EitherIncludeTest.cpp
crypto/symmetric/CipherTest.cpp crypto/symmetric/CipherTest.cpp
crypto/symmetric/testutils/FakeAuthenticatedCipher.cpp
crypto/kdf/SCryptTest.cpp crypto/kdf/SCryptTest.cpp
crypto/kdf/SCryptParametersTest.cpp crypto/kdf/SCryptParametersTest.cpp
crypto/hash/HashTest.cpp crypto/hash/HashTest.cpp
@ -42,7 +40,6 @@ set(SOURCES
logging/LoggingTest.cpp logging/LoggingTest.cpp
logging/LoggerIncludeTest.cpp logging/LoggerIncludeTest.cpp
logging/LoggingIncludeTest.cpp logging/LoggingIncludeTest.cpp
EitherTest.cpp
assert/assert_release_test.cpp assert/assert_release_test.cpp
assert/backtrace_include_test.cpp assert/backtrace_include_test.cpp
assert/assert_include_test.cpp assert/assert_include_test.cpp

View File

@ -5,7 +5,6 @@
#undef NDEBUG #undef NDEBUG
#include "cpp-utils/assert/assert.h" #include "cpp-utils/assert/assert.h"
using testing::MatchesRegex;
TEST(AssertTest_DebugBuild, DoesntDieIfTrue) { TEST(AssertTest_DebugBuild, DoesntDieIfTrue) {
ASSERT(true, "bla"); ASSERT(true, "bla");

View File

@ -2,7 +2,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "cpp-utils/crypto/symmetric/Cipher.h" #include "cpp-utils/crypto/symmetric/Cipher.h"
#include "cpp-utils/crypto/symmetric/ciphers.h" #include "cpp-utils/crypto/symmetric/ciphers.h"
#include "testutils/FakeAuthenticatedCipher.h" #include "cpp-utils/crypto/symmetric/testutils/FakeAuthenticatedCipher.h"
#include "cpp-utils/data/DataFixture.h" #include "cpp-utils/data/DataFixture.h"
#include "cpp-utils/data/Data.h" #include "cpp-utils/data/Data.h"

View File

@ -4,10 +4,7 @@
#include "cpp-utils/data/DataFixture.h" #include "cpp-utils/data/DataFixture.h"
using ::testing::Test; using ::testing::Test;
using ::testing::WithParamInterface;
using ::testing::Values;
namespace bf = boost::filesystem;
using namespace cpputils; using namespace cpputils;

View File

@ -2,11 +2,8 @@
using std::stringstream; using std::stringstream;
using std::string; using std::string;
using std::vector;
using std::istream; using std::istream;
using std::ostream; using std::ostream;
using std::future;
using std::initializer_list;
class ConsoleTest_Ask: public ConsoleTest {}; class ConsoleTest_Ask: public ConsoleTest {};

View File

@ -6,7 +6,6 @@
using namespace cpputils::logging; using namespace cpputils::logging;
using std::string; using std::string;
using testing::MatchesRegex;
class LoggerTest: public LoggingTest {}; class LoggerTest: public LoggingTest {};

View File

@ -4,8 +4,6 @@
#include "cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h" #include "cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h"
using std::string; using std::string;
using boost::none;
using testing::MatchesRegex;
using namespace cpputils; using namespace cpputils;

View File

@ -590,7 +590,7 @@ namespace {
class OnlyMoveable { class OnlyMoveable {
public: public:
OnlyMoveable(int value_): value(value_) {} OnlyMoveable(int value_): value(value_) {}
OnlyMoveable(OnlyMoveable &&source): value(source.value) {source.value = -1;} OnlyMoveable(OnlyMoveable &&source) noexcept: value(source.value) {source.value = -1;}
bool operator==(const OnlyMoveable &rhs) const { bool operator==(const OnlyMoveable &rhs) const {
return value == rhs.value; return value == rhs.value;
} }

View File

@ -6,7 +6,6 @@ using cpputils::unique_ref;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using boost::chrono::milliseconds; using boost::chrono::milliseconds;
using boost::chrono::minutes; using boost::chrono::minutes;
using boost::chrono::duration_cast;
using boost::this_thread::sleep_for; using boost::this_thread::sleep_for;
using namespace cryfs; using namespace cryfs;

View File

@ -3,8 +3,6 @@
#include <cpp-utils/network/FakeHttpClient.h> #include <cpp-utils/network/FakeHttpClient.h>
#include <cpp-utils/pointer/unique_ref.h> #include <cpp-utils/pointer/unique_ref.h>
using std::shared_ptr;
using std::make_shared;
using std::string; using std::string;
using cpputils::FakeHttpClient; using cpputils::FakeHttpClient;
using cpputils::unique_ref; using cpputils::unique_ref;

View File

@ -3,7 +3,6 @@
#include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h> #include <cpp-utils/pointer/unique_ref_boost_optional_gtest_workaround.h>
using namespace cryfs::program_options; using namespace cryfs::program_options;
using std::vector;
using boost::none; using boost::none;
using boost::optional; using boost::optional;
using std::ostream; using std::ostream;

View File

@ -8,12 +8,10 @@
#include <cpp-utils/tempfile/TempFile.h> #include <cpp-utils/tempfile/TempFile.h>
#include <cryfs/config/CryConfigFile.h> #include <cryfs/config/CryConfigFile.h>
using std::vector;
using cpputils::Data; using cpputils::Data;
using cpputils::AES256_GCM; using cpputils::AES256_GCM;
using cpputils::Serpent128_CFB; using cpputils::Serpent128_CFB;
using cpputils::TempFile; using cpputils::TempFile;
namespace bf = boost::filesystem;
using namespace cryfs; using namespace cryfs;
// Test that config files created with (old) versions of cryfs are still loadable. // Test that config files created with (old) versions of cryfs are still loadable.

View File

@ -53,7 +53,7 @@ public:
unique_ref<InMemoryBlockStore2> _baseStore = make_unique_ref<InMemoryBlockStore2>(); unique_ref<InMemoryBlockStore2> _baseStore = make_unique_ref<InMemoryBlockStore2>();
InMemoryBlockStore2 *baseStore = _baseStore.get(); InMemoryBlockStore2 *baseStore = _baseStore.get();
unique_ref<BlockStore2> encryptedStore = cipher.createEncryptedBlockstore(std::move(_baseStore), encKey); unique_ref<BlockStore2> encryptedStore = cipher.createEncryptedBlockstore(std::move(_baseStore), encKey);
bool created = encryptedStore->tryCreate(blockId, std::move(data)); bool created = encryptedStore->tryCreate(blockId, data);
EXPECT_TRUE(created); EXPECT_TRUE(created);
return _loadBlock(baseStore, blockId); return _loadBlock(baseStore, blockId);
} }
@ -61,7 +61,7 @@ public:
template<class Cipher> template<class Cipher>
Data _decryptUsingEncryptedBlockStoreWithCipher(const std::string &encKey, const blockstore::BlockId &blockId, Data data) { Data _decryptUsingEncryptedBlockStoreWithCipher(const std::string &encKey, const blockstore::BlockId &blockId, Data data) {
unique_ref<InMemoryBlockStore2> baseStore = make_unique_ref<InMemoryBlockStore2>(); unique_ref<InMemoryBlockStore2> baseStore = make_unique_ref<InMemoryBlockStore2>();
bool created = baseStore->tryCreate(blockId, std::move(data)); bool created = baseStore->tryCreate(blockId, data);
EXPECT_TRUE(created); EXPECT_TRUE(created);
EncryptedBlockStore2<Cipher> encryptedStore(std::move(baseStore), Cipher::EncryptionKey::FromString(encKey)); EncryptedBlockStore2<Cipher> encryptedStore(std::move(baseStore), Cipher::EncryptionKey::FromString(encKey));
return _loadBlock(&encryptedStore, blockId); return _loadBlock(&encryptedStore, blockId);

View File

@ -10,17 +10,12 @@ using namespace cryfs;
using boost::optional; using boost::optional;
using boost::none; using boost::none;
using cpputils::Console;
using cpputils::NoninteractiveConsole; using cpputils::NoninteractiveConsole;
using cpputils::unique_ref;
using cpputils::make_unique_ref;
using std::string; using std::string;
using std::vector;
using std::shared_ptr; using std::shared_ptr;
using std::make_shared; using std::make_shared;
using ::testing::_; using ::testing::_;
using ::testing::Return; using ::testing::Return;
using ::testing::Invoke;
using ::testing::ValuesIn; using ::testing::ValuesIn;
using ::testing::HasSubstr; using ::testing::HasSubstr;
using ::testing::UnorderedElementsAreArray; using ::testing::UnorderedElementsAreArray;

View File

@ -10,23 +10,15 @@
using namespace cryfs; using namespace cryfs;
using boost::optional;
using boost::none; using boost::none;
using cpputils::Console;
using cpputils::NoninteractiveConsole; using cpputils::NoninteractiveConsole;
using cpputils::unique_ref;
using cpputils::make_unique_ref;
using std::string; using std::string;
using std::vector;
using std::shared_ptr; using std::shared_ptr;
using std::make_shared; using std::make_shared;
using ::testing::_; using ::testing::_;
using ::testing::Return; using ::testing::Return;
using ::testing::Invoke;
using ::testing::ValuesIn;
using ::testing::HasSubstr; using ::testing::HasSubstr;
using ::testing::UnorderedElementsAreArray; using ::testing::UnorderedElementsAreArray;
using ::testing::WithParamInterface;
#define EXPECT_ASK_TO_USE_DEFAULT_SETTINGS() \ #define EXPECT_ASK_TO_USE_DEFAULT_SETTINGS() \
EXPECT_CALL(*console, askYesNo("Use default settings?", true)).Times(1) EXPECT_CALL(*console, askYesNo("Use default settings?", true)).Times(1)

View File

@ -10,8 +10,6 @@
#include <gitversion/gitversion.h> #include <gitversion/gitversion.h>
#include <gitversion/VersionCompare.h> #include <gitversion/VersionCompare.h>
using cpputils::unique_ref;
using cpputils::make_unique_ref;
using cpputils::TempFile; using cpputils::TempFile;
using cpputils::SCrypt; using cpputils::SCrypt;
using cpputils::DataFixture; using cpputils::DataFixture;
@ -23,7 +21,6 @@ using std::string;
using std::ostream; using std::ostream;
using std::make_shared; using std::make_shared;
using ::testing::Return; using ::testing::Return;
using ::testing::_;
using ::testing::HasSubstr; using ::testing::HasSubstr;
using namespace cryfs; using namespace cryfs;

View File

@ -4,8 +4,6 @@
using cpputils::Data; using cpputils::Data;
using cpputils::DataFixture; using cpputils::DataFixture;
using cpputils::Deserializer;
using cpputils::Serializer;
using boost::none; using boost::none;
using std::ostream; using std::ostream;
using namespace cryfs; using namespace cryfs;

View File

@ -16,19 +16,14 @@
//TODO (whole project) Make constructors explicit when implicit construction not needed //TODO (whole project) Make constructors explicit when implicit construction not needed
using ::testing::Test; using ::testing::Test;
using ::testing::Return;
using ::testing::_;
using std::make_shared; using std::make_shared;
using cpputils::TempDir; using cpputils::TempDir;
using cpputils::TempFile; using cpputils::TempFile;
using cpputils::dynamic_pointer_move;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using cpputils::unique_ref; using cpputils::unique_ref;
using cpputils::Console;
using cpputils::Random; using cpputils::Random;
using cpputils::SCrypt; using cpputils::SCrypt;
using cpputils::Data; using cpputils::Data;
using cpputils::system::FakeHomeDirectoryRAII;
using cpputils::NoninteractiveConsole; using cpputils::NoninteractiveConsole;
using blockstore::ondisk::OnDiskBlockStore2; using blockstore::ondisk::OnDiskBlockStore2;
using boost::none; using boost::none;

View File

@ -13,8 +13,6 @@ using cpputils::Random;
using cpputils::SCrypt; using cpputils::SCrypt;
using cpputils::NoninteractiveConsole; using cpputils::NoninteractiveConsole;
using fspp::Device; using fspp::Device;
using ::testing::Return;
using ::testing::_;
using boost::none; using boost::none;
using std::make_shared; using std::make_shared;
using blockstore::inmemory::InMemoryBlockStore2; using blockstore::inmemory::InMemoryBlockStore2;

View File

@ -3,8 +3,6 @@
using namespace fspp::fuse; using namespace fspp::fuse;
using namespace fspp::fuse; using namespace fspp::fuse;
using ::testing::_;
using ::testing::StrEq;
typedef FuseTest BasicFuseTest; typedef FuseTest BasicFuseTest;

View File

@ -1,6 +1,5 @@
#include "testutils/FuseAccessTest.h" #include "testutils/FuseAccessTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return; using ::testing::Return;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -2,15 +2,8 @@
#include "../../testutils/OpenFileHandle.h" #include "../../testutils/OpenFileHandle.h"
#include <condition_variable> #include <condition_variable>
using ::testing::_;
using ::testing::StrEq;
using ::testing::Eq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Return;
using ::testing::Invoke;
using ::testing::InSequence;
using ::testing::AtLeast;
using std::string; using std::string;
using std::mutex; using std::mutex;

View File

@ -1,10 +1,7 @@
#include "testutils/FuseCreateAndOpenTest.h" #include "testutils/FuseCreateAndOpenTest.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Return;
class FuseCreateAndOpenFlagsTest: public FuseCreateAndOpenTest, public WithParamInterface<mode_t> { class FuseCreateAndOpenFlagsTest: public FuseCreateAndOpenTest, public WithParamInterface<mode_t> {
}; };

View File

@ -1,6 +1,5 @@
#include "FuseCreateAndOpenTest.h" #include "FuseCreateAndOpenTest.h"
using ::testing::_;
using cpputils::unique_ref; using cpputils::unique_ref;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;

View File

@ -2,8 +2,6 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;

View File

@ -2,8 +2,6 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;

View File

@ -7,7 +7,6 @@ using ::testing::StrEq;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return; using ::testing::Return;
using ::testing::Throw; using ::testing::Throw;
using ::testing::AtLeast;
using ::testing::Values; using ::testing::Values;
using ::testing::_; using ::testing::_;

View File

@ -6,7 +6,6 @@ using ::testing::Eq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Return; using ::testing::Return;
using ::testing::AtLeast;
using std::string; using std::string;

View File

@ -3,15 +3,11 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return;
using ::testing::Throw; using ::testing::Throw;
using cpputils::unique_ref;
using cpputils::make_unique_ref;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -3,12 +3,9 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return;
using ::testing::Throw;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -2,8 +2,6 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;

View File

@ -2,8 +2,6 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;

View File

@ -3,7 +3,6 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;

View File

@ -3,12 +3,10 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return; using ::testing::Return;
using ::testing::Throw;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -1,7 +1,5 @@
#include "testutils/FuseFTruncateTest.h" #include "testutils/FuseFTruncateTest.h"
using ::testing::_;
using ::testing::StrEq;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return; using ::testing::Return;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -6,12 +6,12 @@ using ::testing::_;
using ::testing::Invoke; using ::testing::Invoke;
void FuseLstatTest::LstatPath(const std::string &path) { void FuseLstatTest::LstatPath(const std::string &path) {
struct stat dummy; struct stat dummy{};
LstatPath(path, &dummy); LstatPath(path, &dummy);
} }
int FuseLstatTest::LstatPathReturnError(const std::string &path) { int FuseLstatTest::LstatPathReturnError(const std::string &path) {
struct stat dummy; struct stat dummy{};
return LstatPathReturnError(path, &dummy); return LstatPathReturnError(path, &dummy);
} }
@ -45,7 +45,7 @@ struct stat FuseLstatTest::CallLstatWithImpl(function<void(struct stat*)> implem
implementation(stat); implementation(stat);
})); }));
struct stat result; struct stat result{};
LstatPath(FILENAME, &result); LstatPath(FILENAME, &result);
return result; return result;

View File

@ -2,9 +2,6 @@
using ::testing::_; using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return;
using ::testing::Invoke;
using ::testing::Action;
class FuseMkdirDirnameTest: public FuseMkdirTest { class FuseMkdirDirnameTest: public FuseMkdirTest {
}; };

View File

@ -2,7 +2,6 @@
using ::testing::_; using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;

View File

@ -1,6 +1,5 @@
#include "testutils/FuseOpenTest.h" #include "testutils/FuseOpenTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;

View File

@ -3,12 +3,10 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Ne; using ::testing::Ne;
using ::testing::Return;
using ::testing::Invoke; using ::testing::Invoke;
using ::testing::Throw; using ::testing::Throw;

View File

@ -3,13 +3,9 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return;
using ::testing::Invoke;
using ::testing::Throw;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -3,13 +3,7 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::Eq;
using ::testing::Return;
using ::testing::Invoke;
using ::testing::Action;
using std::min;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -10,18 +10,14 @@
#include <cstdlib> #include <cstdlib>
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Combine; using ::testing::Combine;
using ::testing::Eq;
using ::testing::Return;
using ::testing::Invoke; using ::testing::Invoke;
using ::testing::Action; using ::testing::Action;
using std::tuple; using std::tuple;
using std::get; using std::get;
using std::min;
using cpputils::Data; using cpputils::Data;
using cpputils::DataFixture; using cpputils::DataFixture;

View File

@ -14,7 +14,7 @@ FuseReadTest::ReadError FuseReadTest::ReadFileReturnError(const char *filename,
auto fd = OpenFile(fs.get(), filename); auto fd = OpenFile(fs.get(), filename);
ReadError result; ReadError result{};
errno = 0; errno = 0;
result.read_bytes = ::pread(fd->fd(), buf, count, offset); result.read_bytes = ::pread(fd->fd(), buf, count, offset);
result.error = errno; result.error = errno;

View File

@ -1,10 +1,7 @@
#include "testutils/FuseReadDirTest.h" #include "testutils/FuseReadDirTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return;
using std::vector;
using std::string; using std::string;
class FuseReadDirDirnameTest: public FuseReadDirTest { class FuseReadDirDirnameTest: public FuseReadDirTest {

View File

@ -2,13 +2,11 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using std::vector;
using std::string; using std::string;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -2,9 +2,7 @@
#include <cpp-utils/pointer/unique_ref.h> #include <cpp-utils/pointer/unique_ref.h>
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
@ -14,7 +12,6 @@ using std::vector;
using std::string; using std::string;
using namespace fspp::fuse; using namespace fspp::fuse;
using fspp::Dir;
unique_ref<vector<string>> LARGE_DIR(int num_entries) { unique_ref<vector<string>> LARGE_DIR(int num_entries) {
auto result = make_unique_ref<vector<string>>(); auto result = make_unique_ref<vector<string>>();

View File

@ -4,7 +4,6 @@ using cpputils::unique_ref;
using cpputils::make_unique_ref; using cpputils::make_unique_ref;
using std::vector; using std::vector;
using std::string; using std::string;
using std::initializer_list;
using ::testing::Action; using ::testing::Action;
using ::testing::Return; using ::testing::Return;

View File

@ -1,7 +1,6 @@
#include "testutils/FuseRenameTest.h" #include "testutils/FuseRenameTest.h"
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -1,10 +1,7 @@
#include "testutils/FuseRenameTest.h" #include "testutils/FuseRenameTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return; using ::testing::Return;
using ::testing::Invoke;
using ::testing::Action;
class FuseRenameFilenameTest: public FuseRenameTest { class FuseRenameFilenameTest: public FuseRenameTest {
}; };

View File

@ -1,7 +1,5 @@
#include "FuseRenameTest.h" #include "FuseRenameTest.h"
using ::testing::Action;
using ::testing::Invoke;
void FuseRenameTest::Rename(const char *from, const char *to) { void FuseRenameTest::Rename(const char *from, const char *to) {
int error = RenameReturnError(from, to); int error = RenameReturnError(from, to);

View File

@ -1,10 +1,6 @@
#include "testutils/FuseRmdirTest.h" #include "testutils/FuseRmdirTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return;
using ::testing::Invoke;
using ::testing::Action;
class FuseRmdirDirnameTest: public FuseRmdirTest { class FuseRmdirDirnameTest: public FuseRmdirTest {
}; };

View File

@ -1,7 +1,6 @@
#include "testutils/FuseRmdirTest.h" #include "testutils/FuseRmdirTest.h"
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -6,12 +6,12 @@ using ::testing::_;
using ::testing::Invoke; using ::testing::Invoke;
void FuseStatfsTest::Statfs(const std::string &path) { void FuseStatfsTest::Statfs(const std::string &path) {
struct ::statvfs dummy; struct ::statvfs dummy{};
Statfs(path, &dummy); Statfs(path, &dummy);
} }
int FuseStatfsTest::StatfsReturnError(const std::string &path) { int FuseStatfsTest::StatfsReturnError(const std::string &path) {
struct ::statvfs dummy; struct ::statvfs dummy{};
return StatfsReturnError(path, &dummy); return StatfsReturnError(path, &dummy);
} }
@ -38,7 +38,7 @@ struct ::statvfs FuseStatfsTest::CallStatfsWithImpl(function<void(struct ::statv
implementation(stat); implementation(stat);
})); }));
struct ::statvfs result; struct ::statvfs result{};
Statfs(FILENAME, &result); Statfs(FILENAME, &result);
return result; return result;

View File

@ -1,6 +1,5 @@
#include "testutils/FuseTruncateTest.h" #include "testutils/FuseTruncateTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return; using ::testing::Return;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -1,7 +1,6 @@
#include "testutils/FuseUnlinkTest.h" #include "testutils/FuseUnlinkTest.h"
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Throw; using ::testing::Throw;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -1,10 +1,6 @@
#include "testutils/FuseUnlinkTest.h" #include "testutils/FuseUnlinkTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return;
using ::testing::Invoke;
using ::testing::Action;
class FuseUnlinkFilenameTest: public FuseUnlinkTest { class FuseUnlinkFilenameTest: public FuseUnlinkTest {
}; };

View File

@ -1,6 +1,5 @@
#include "testutils/FuseUtimensTest.h" #include "testutils/FuseUtimensTest.h"
using ::testing::_;
using ::testing::StrEq; using ::testing::StrEq;
using ::testing::Return; using ::testing::Return;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;

View File

@ -25,7 +25,7 @@ int FuseUtimensTest::UtimensReturnError(const char *filename, timespec lastAcces
} }
struct timespec FuseUtimensTest::makeTimespec(time_t tv_sec, long tv_nsec) { struct timespec FuseUtimensTest::makeTimespec(time_t tv_sec, long tv_nsec) {
struct timespec result; struct timespec result{};
result.tv_sec = tv_sec; result.tv_sec = tv_sec;
result.tv_nsec = tv_nsec; result.tv_nsec = tv_nsec;
return result; return result;

View File

@ -8,18 +8,14 @@
#include <cstdlib> #include <cstdlib>
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Combine; using ::testing::Combine;
using ::testing::Eq;
using ::testing::Return;
using ::testing::Invoke; using ::testing::Invoke;
using ::testing::Action; using ::testing::Action;
using std::tuple; using std::tuple;
using std::get; using std::get;
using std::min;
using cpputils::Data; using cpputils::Data;
using cpputils::DataFixture; using cpputils::DataFixture;

View File

@ -3,12 +3,10 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Ne; using ::testing::Ne;
using ::testing::Return;
using ::testing::Invoke; using ::testing::Invoke;
using ::testing::Throw; using ::testing::Throw;

View File

@ -3,13 +3,10 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::WithParamInterface; using ::testing::WithParamInterface;
using ::testing::Values; using ::testing::Values;
using ::testing::Eq; using ::testing::Eq;
using ::testing::Return; using ::testing::Return;
using ::testing::Invoke;
using ::testing::Throw;
using namespace fspp::fuse; using namespace fspp::fuse;

View File

@ -5,13 +5,9 @@
#include "fspp/fuse/FuseErrnoException.h" #include "fspp/fuse/FuseErrnoException.h"
using ::testing::_; using ::testing::_;
using ::testing::StrEq;
using ::testing::Eq;
using ::testing::Return;
using ::testing::Invoke; using ::testing::Invoke;
using ::testing::Action; using ::testing::Action;
using std::min;
using cpputils::DataFixture; using cpputils::DataFixture;
using cpputils::Data; using cpputils::Data;

Some files were not shown because too many files have changed in this diff Show More