Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ak0327 committed Aug 24, 2023
1 parent 227b5fc commit 20a9f71
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ unit :
cmake -S . -B build
cmake --build build
#cd build && ctest
cd build && ./unit_test
./build/unit_test

-include $(DEPS)
136 changes: 68 additions & 68 deletions test/unit_test/is_valid_file_path/test_get_valid_config_file_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,99 +10,99 @@
// }

TEST(TEST_get_valid_config_file_path, simple_test1) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.conf"));
}

TEST(TEST_get_valid_config_file_path, simple_test2) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.CONF", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.CONF"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.CONF", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.CONF"));
}
TEST(TEST_get_valid_config_file_path, simple_test3) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.Conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.Conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.Conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.Conf"));
}
TEST(TEST_get_valid_config_file_path, simple_test4) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.conF", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.conF"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.conF", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.conF"));
}
TEST(TEST_get_valid_config_file_path, simple_test5) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/a.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/a.conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/a.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/a.conf"));
}
TEST(TEST_get_valid_config_file_path, simple_test6) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/a.b.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/a.b.conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/a.b.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/a.b.conf"));
}


TEST(TEST_get_valid_config_file_path, simple_test) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.conf"));
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.CONF", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.CONF"));
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.Conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.Conf"));
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/file.conF", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file.conF"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/file"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/nothing.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/nothing"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/conf"));

EXPECT_EQ("../test/unit_test/is_valid_file_path/files/a.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/a.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/ a.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/a.conf "));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/ a.conf "));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/X.conf"));

EXPECT_EQ("../test/unit_test/is_valid_file_path/files/a.b.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/a.b.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/a.conf.b"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/conf.a"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/conf.a."));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.CONF", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.CONF"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.Conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.Conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/file.conF", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file.conF"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/file"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/nothing.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/nothing"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/conf"));

EXPECT_EQ("test/unit_test/is_valid_file_path/files/a.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/a.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/ a.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/a.conf "));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/ a.conf "));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/X.conf"));

EXPECT_EQ("test/unit_test/is_valid_file_path/files/a.b.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/a.b.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/a.conf.b"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/conf.a"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/conf.a."));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)""));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"."));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)".."));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir.conf"));
}

TEST(TEST_get_valid_config_file_path, test_dir_rwx) {
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/dir/file_rrr.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_rrr.conf"));
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/dir/file_rr-.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_rr-.conf"));
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/dir/file_r-r.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_r-r.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_-rr")); // git add permission denied
EXPECT_EQ("../test/unit_test/is_valid_file_path/files/dir/file_r--.conf", get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_r--.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_-r-")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_--r")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_---")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/this_is_dir.conf"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_rrr"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_rrr"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_rr-"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_-rr")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_r-r"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_-r-")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_--r")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_---")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/file_r--"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/dir/this_is_dir"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/dir/file_rrr.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_rrr.conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/dir/file_rr-.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_rr-.conf"));
EXPECT_EQ("test/unit_test/is_valid_file_path/files/dir/file_r-r.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_r-r.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_-rr")); // git add permission denied
EXPECT_EQ("test/unit_test/is_valid_file_path/files/dir/file_r--.conf", get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_r--.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_-r-")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_--r")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_---")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/this_is_dir.conf"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_rrr"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_rrr"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_rr-"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_-rr")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_r-r"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_-r-")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_--r")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_---")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/file_r--"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/dir/this_is_dir"));

}

TEST(TEST_get_valid_config_file_path, test_dir_rw) {
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_rrr.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_rr-.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_r-r.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_-rr.conf")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_r--.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_-r-.conf")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_--r.conf")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_---.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/thid_is_dir.conf"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_rrr"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_rr-"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_r-r"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_-rr")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_r--"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_-r-")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_--r")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/file_---")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"../test/unit_test/is_valid_file_path/files/no_x_dir/thid_is_dir"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_rrr.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_rr-.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_r-r.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_-rr.conf")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_r--.conf"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_-r-.conf")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_--r.conf")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_---.conf"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/thid_is_dir.conf"));

EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_rrr"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_rr-"));
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_r-r"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_-rr")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_r--"));
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_-r-")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_--r")); // git add permission denied
// EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/file_---")); // git add permission denied
EXPECT_ANY_THROW(get_valid_config_file_path((char *)"test/unit_test/is_valid_file_path/files/no_x_dir/thid_is_dir"));
}

0 comments on commit 20a9f71

Please sign in to comment.