Merge branch 'develop' into next
This commit is contained in:
commit
af24fa5402
@ -19,7 +19,7 @@ public:
|
|||||||
|
|
||||||
// Test cases only run for file nodes
|
// Test cases only run for file nodes
|
||||||
template<class ConcreteFileSystemTestFixture>
|
template<class ConcreteFileSystemTestFixture>
|
||||||
class FsppNodeTest_Stat_FileOnly: public FileSystemTest<ConcreteFileSystemTestFixture>, public FsppNodeTest_File_Helper {};
|
class FsppNodeTest_Stat_FileOnly: public FileSystemTest<ConcreteFileSystemTestFixture>, public FsppNodeTestHelper {};
|
||||||
|
|
||||||
TYPED_TEST_CASE_P(FsppNodeTest_Stat_FileOnly);
|
TYPED_TEST_CASE_P(FsppNodeTest_Stat_FileOnly);
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ TYPED_TEST_P(FsppNodeTest_Stat_FileOnly, FileIsFile) {
|
|||||||
|
|
||||||
// Test cases only run for dir nodes
|
// Test cases only run for dir nodes
|
||||||
template<class ConcreteFileSystemTestFixture>
|
template<class ConcreteFileSystemTestFixture>
|
||||||
class FsppNodeTest_Stat_DirOnly: public FileSystemTest<ConcreteFileSystemTestFixture>, public FsppNodeTest_Dir_Helper {};
|
class FsppNodeTest_Stat_DirOnly: public FileSystemTest<ConcreteFileSystemTestFixture>, public FsppNodeTestHelper {};
|
||||||
|
|
||||||
TYPED_TEST_CASE_P(FsppNodeTest_Stat_DirOnly);
|
TYPED_TEST_CASE_P(FsppNodeTest_Stat_DirOnly);
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ TYPED_TEST_P(FsppNodeTest_Stat_DirOnly, DirIsDir) {
|
|||||||
|
|
||||||
// Test cases only run for symlink nodes
|
// Test cases only run for symlink nodes
|
||||||
template<class ConcreteFileSystemTestFixture>
|
template<class ConcreteFileSystemTestFixture>
|
||||||
class FsppNodeTest_Stat_SymlinkOnly: public FileSystemTest<ConcreteFileSystemTestFixture>, public FsppNodeTest_Symlink_Helper {};
|
class FsppNodeTest_Stat_SymlinkOnly: public FileSystemTest<ConcreteFileSystemTestFixture>, public FsppNodeTestHelper {};
|
||||||
|
|
||||||
TYPED_TEST_CASE_P(FsppNodeTest_Stat_SymlinkOnly);
|
TYPED_TEST_CASE_P(FsppNodeTest_Stat_SymlinkOnly);
|
||||||
|
|
||||||
|
@ -7,12 +7,19 @@
|
|||||||
#include <boost/preprocessor/variadic/to_seq.hpp>
|
#include <boost/preprocessor/variadic/to_seq.hpp>
|
||||||
#include <boost/preprocessor/seq/for_each.hpp>
|
#include <boost/preprocessor/seq/for_each.hpp>
|
||||||
|
|
||||||
// TODO separation into File/Dir/Symlink Helpers probably not needed anymore
|
class FsppNodeTestHelper {
|
||||||
|
|
||||||
class FsppNodeTestBase {
|
|
||||||
public:
|
public:
|
||||||
virtual void IN_STAT(fspp::Node *node, std::function<void (struct stat)> callback) = 0;
|
void IN_STAT(fspp::Node *file, std::function<void (struct stat)> callback) {
|
||||||
virtual void EXPECT_SIZE(uint64_t expectedSize, fspp::Node *node) = 0;
|
struct stat st;
|
||||||
|
file->stat(&st);
|
||||||
|
callback(st);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EXPECT_SIZE(uint64_t expectedSize, fspp::Node *node) {
|
||||||
|
IN_STAT(node, [expectedSize] (struct stat st) {
|
||||||
|
EXPECT_EQ(expectedSize, (uint64_t)st.st_size);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -24,56 +31,11 @@ public:
|
|||||||
* See FsppNodeTest_Rename for an example.
|
* See FsppNodeTest_Rename for an example.
|
||||||
*/
|
*/
|
||||||
template<class ConcreteFileSystemTestFixture>
|
template<class ConcreteFileSystemTestFixture>
|
||||||
class FsppNodeTest: public virtual FsppNodeTestBase, public virtual FileSystemTest<ConcreteFileSystemTestFixture> {
|
class FsppNodeTest: public virtual FsppNodeTestHelper, public virtual FileSystemTest<ConcreteFileSystemTestFixture> {
|
||||||
public:
|
public:
|
||||||
virtual cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) = 0;
|
virtual cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FsppNodeTest_File_Helper: public virtual FsppNodeTestBase {
|
|
||||||
public:
|
|
||||||
void IN_STAT(fspp::Node *file, std::function<void (struct stat)> callback) override {
|
|
||||||
struct stat st;
|
|
||||||
file->stat(&st);
|
|
||||||
callback(st);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EXPECT_SIZE(uint64_t expectedSize, fspp::Node *node) override {
|
|
||||||
IN_STAT(node, [expectedSize] (struct stat st) {
|
|
||||||
EXPECT_EQ(expectedSize, (uint64_t)st.st_size);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class FsppNodeTest_Dir_Helper: public virtual FsppNodeTestBase {
|
|
||||||
public:
|
|
||||||
void IN_STAT(fspp::Node *file, std::function<void (struct stat)> callback) override {
|
|
||||||
struct stat st;
|
|
||||||
file->stat(&st);
|
|
||||||
callback(st);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EXPECT_SIZE(uint64_t expectedSize, fspp::Node *node) override {
|
|
||||||
IN_STAT(node, [expectedSize] (struct stat st) {
|
|
||||||
EXPECT_EQ(expectedSize, (uint64_t)st.st_size);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class FsppNodeTest_Symlink_Helper: public virtual FsppNodeTestBase {
|
|
||||||
public:
|
|
||||||
void IN_STAT(fspp::Node *file, std::function<void (struct stat)> callback) override {
|
|
||||||
struct stat st;
|
|
||||||
file->stat(&st);
|
|
||||||
callback(st);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EXPECT_SIZE(uint64_t expectedSize, fspp::Node *node) override {
|
|
||||||
IN_STAT(node, [expectedSize] (struct stat st) {
|
|
||||||
EXPECT_EQ(expectedSize, (uint64_t)st.st_size);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#define _REGISTER_SINGLE_NODE_TEST_CASE(r, Class, Name) \
|
#define _REGISTER_SINGLE_NODE_TEST_CASE(r, Class, Name) \
|
||||||
TYPED_TEST_P(Class, Name) { \
|
TYPED_TEST_P(Class, Name) { \
|
||||||
this->BOOST_PP_CAT(Test_,Name)(); \
|
this->BOOST_PP_CAT(Test_,Name)(); \
|
||||||
@ -85,7 +47,7 @@ public:
|
|||||||
|
|
||||||
#define _REGISTER_FILE_TEST_CASE(Class, ...) \
|
#define _REGISTER_FILE_TEST_CASE(Class, ...) \
|
||||||
template<class ConcreteFileSystemTestFixture> \
|
template<class ConcreteFileSystemTestFixture> \
|
||||||
class Class##_FileNode: public Class<ConcreteFileSystemTestFixture>, public FsppNodeTest_File_Helper { \
|
class Class##_FileNode: public Class<ConcreteFileSystemTestFixture>, public virtual FsppNodeTestHelper { \
|
||||||
public: \
|
public: \
|
||||||
cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) override { \
|
cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) override { \
|
||||||
this->CreateFile(path); \
|
this->CreateFile(path); \
|
||||||
@ -97,7 +59,7 @@ public:
|
|||||||
|
|
||||||
#define _REGISTER_DIR_TEST_CASE(Class, ...) \
|
#define _REGISTER_DIR_TEST_CASE(Class, ...) \
|
||||||
template<class ConcreteFileSystemTestFixture> \
|
template<class ConcreteFileSystemTestFixture> \
|
||||||
class Class##_DirNode: public Class<ConcreteFileSystemTestFixture>, public FsppNodeTest_Dir_Helper { \
|
class Class##_DirNode: public Class<ConcreteFileSystemTestFixture>, public virtual FsppNodeTestHelper { \
|
||||||
public: \
|
public: \
|
||||||
cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) override { \
|
cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) override { \
|
||||||
this->CreateDir(path); \
|
this->CreateDir(path); \
|
||||||
@ -109,7 +71,7 @@ public:
|
|||||||
|
|
||||||
#define _REGISTER_SYMLINK_TEST_CASE(Class, ...) \
|
#define _REGISTER_SYMLINK_TEST_CASE(Class, ...) \
|
||||||
template<class ConcreteFileSystemTestFixture> \
|
template<class ConcreteFileSystemTestFixture> \
|
||||||
class Class##_SymlinkNode: public Class<ConcreteFileSystemTestFixture>, public FsppNodeTest_Symlink_Helper { \
|
class Class##_SymlinkNode: public Class<ConcreteFileSystemTestFixture>, public virtual FsppNodeTestHelper { \
|
||||||
public: \
|
public: \
|
||||||
cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) override { \
|
cpputils::unique_ref<fspp::Node> CreateNode(const boost::filesystem::path &path) override { \
|
||||||
this->CreateSymlink(path); \
|
this->CreateSymlink(path); \
|
||||||
|
Loading…
Reference in New Issue
Block a user