diff options
Diffstat (limited to 'kernel/src/filesystem/path.tests.cpp')
| -rw-r--r-- | kernel/src/filesystem/path.tests.cpp | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/kernel/src/filesystem/path.tests.cpp b/kernel/src/filesystem/path.tests.cpp deleted file mode 100644 index 3c18b5c2..00000000 --- a/kernel/src/filesystem/path.tests.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include <kernel/filesystem/path.hpp> - -#include <catch2/catch_test_macros.hpp> - -#include <algorithm> -#include <string> -#include <string_view> -#include <vector> - -SCENARIO("path utilities", "[filesystem][path]") -{ - GIVEN("valid and invalid paths") - { - THEN("valid absolute paths are recognized as valid") - { - REQUIRE(kernel::filesystem::path::is_valid_path("/valid/absolute/path")); - REQUIRE(kernel::filesystem::path::is_valid_path("/")); - } - - THEN("valid relative paths are recognized as valid") - { - REQUIRE(kernel::filesystem::path::is_valid_path("valid/../relative/.././path")); - REQUIRE(kernel::filesystem::path::is_valid_path("valid/relative/path")); - REQUIRE(kernel::filesystem::path::is_valid_path("file.txt")); - } - - THEN("invalid paths are recognized as invalid") - { - REQUIRE_FALSE(kernel::filesystem::path::is_valid_path("")); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_path(std::string(4096, 'a'))); - } - - THEN("valid absolute paths are recognized as absolute") - { - REQUIRE(kernel::filesystem::path::is_valid_absolute_path("/valid/absolute/path")); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_absolute_path("valid/relative/path")); - } - - THEN("invalid paths are not recognized as absolute") - { - REQUIRE_FALSE(kernel::filesystem::path::is_valid_absolute_path("")); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_absolute_path(std::string(4096, 'a'))); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_absolute_path("invalid/absolute/path")); - } - - THEN("valid relative paths are recognized as relative") - { - REQUIRE(kernel::filesystem::path::is_valid_relative_path("valid/relative/path")); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_relative_path("/valid/absolute/path")); - } - - THEN("invalid paths are not recognized as relative") - { - REQUIRE_FALSE(kernel::filesystem::path::is_valid_relative_path("")); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_relative_path(std::string(4096, 'a'))); - REQUIRE_FALSE(kernel::filesystem::path::is_valid_relative_path("/invalid/absolute/path")); - } - } - - GIVEN("a valid path") - { - THEN("it can be split into components") - { - auto components = kernel::filesystem::path::split("/a/b///c/d.txt"); - std::vector<std::string_view> expected = {"a", "b", "c", "d.txt"}; - REQUIRE(std::ranges::equal(components, expected)); - } - } -}
\ No newline at end of file |
