mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-28 09:00:52 +01:00
31 lines
720 B
C++
31 lines
720 B
C++
#include <catch2/catch.hpp>
|
|
#include <filesystem>
|
|
#include <FEXHeaderUtils/Filesystem.h>
|
|
|
|
#define TestPath(Path) \
|
|
REQUIRE(std::string_view(FHU::Filesystem::LexicallyNormal(Path)) == std::string_view(std::filesystem::path(Path).lexically_normal().string()));
|
|
|
|
TEST_CASE("LexicallyNormal") {
|
|
TestPath("");
|
|
TestPath("/");
|
|
TestPath("/./");
|
|
TestPath("//.");
|
|
TestPath("//./");
|
|
TestPath("//.//");
|
|
|
|
TestPath(".");
|
|
TestPath("..");
|
|
TestPath(".//");
|
|
TestPath("../../");
|
|
TestPath("././");
|
|
TestPath("./../");
|
|
TestPath("./../");
|
|
TestPath("./.././.././.");
|
|
TestPath("./.././.././..");
|
|
|
|
TestPath("./foo/../");
|
|
TestPath("foo/./bar/..");
|
|
TestPath("foo/.///bar/..");
|
|
TestPath("foo/.///bar/../");
|
|
}
|