From 20a9f7163a320f5d6ce5ead252a4ac7fd4120a0d Mon Sep 17 00:00:00 2001 From: takira Date: Thu, 24 Aug 2023 10:42:17 +0900 Subject: [PATCH] test --- Makefile | 2 +- .../test_get_valid_config_file_path.cpp | 136 +++++++++--------- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Makefile b/Makefile index 81acd967..2384aa36 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,6 @@ unit : cmake -S . -B build cmake --build build #cd build && ctest - cd build && ./unit_test + ./build/unit_test -include $(DEPS) \ No newline at end of file diff --git a/test/unit_test/is_valid_file_path/test_get_valid_config_file_path.cpp b/test/unit_test/is_valid_file_path/test_get_valid_config_file_path.cpp index bbbc7212..196cef21 100644 --- a/test/unit_test/is_valid_file_path/test_get_valid_config_file_path.cpp +++ b/test/unit_test/is_valid_file_path/test_get_valid_config_file_path.cpp @@ -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")); }