feat(tests): rework tests in numerous ways (#3059)
This commit is contained in:
parent
3088823ffc
commit
764ce03520
19 changed files with 316 additions and 446 deletions
|
|
@ -4,9 +4,9 @@
|
|||
*/
|
||||
#include <src/file_handler.h>
|
||||
|
||||
#include <tests/conftest.cpp>
|
||||
#include "../tests_common.h"
|
||||
|
||||
class FileHandlerParentDirectoryTest: public ::testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
struct FileHandlerParentDirectoryTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
|
||||
TEST_P(FileHandlerParentDirectoryTest, Run) {
|
||||
auto [input, expected] = GetParam();
|
||||
|
|
@ -16,12 +16,12 @@ TEST_P(FileHandlerParentDirectoryTest, Run) {
|
|||
INSTANTIATE_TEST_SUITE_P(
|
||||
FileHandlerTests,
|
||||
FileHandlerParentDirectoryTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("/path/to/file.txt", "/path/to"),
|
||||
std::make_tuple("/path/to/directory", "/path/to"),
|
||||
std::make_tuple("/path/to/directory/", "/path/to")));
|
||||
|
||||
class FileHandlerMakeDirectoryTest: public ::testing::TestWithParam<std::tuple<std::string, bool, bool>> {};
|
||||
struct FileHandlerMakeDirectoryTest: testing::TestWithParam<std::tuple<std::string, bool, bool>> {};
|
||||
|
||||
TEST_P(FileHandlerMakeDirectoryTest, Run) {
|
||||
auto [input, expected, remove] = GetParam();
|
||||
|
|
@ -41,28 +41,18 @@ TEST_P(FileHandlerMakeDirectoryTest, Run) {
|
|||
INSTANTIATE_TEST_SUITE_P(
|
||||
FileHandlerTests,
|
||||
FileHandlerMakeDirectoryTest,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple("dir_123", true, false),
|
||||
std::make_tuple("dir_123", true, true),
|
||||
std::make_tuple("dir_123/abc", true, false),
|
||||
std::make_tuple("dir_123/abc", true, true)));
|
||||
|
||||
class FileHandlerTests: public virtual BaseTest, public ::testing::WithParamInterface<std::tuple<int, std::string>> {
|
||||
protected:
|
||||
void
|
||||
SetUp() override {
|
||||
BaseTest::SetUp();
|
||||
}
|
||||
struct FileHandlerTests: testing::TestWithParam<std::tuple<int, std::string>> {};
|
||||
|
||||
void
|
||||
TearDown() override {
|
||||
BaseTest::TearDown();
|
||||
}
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
TestFiles,
|
||||
FileHandlerTests,
|
||||
::testing::Values(
|
||||
testing::Values(
|
||||
std::make_tuple(0, ""), // empty file
|
||||
std::make_tuple(1, "a"), // single character
|
||||
std::make_tuple(2, "Mr. Blue Sky - Electric Light Orchestra"), // single line
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue