diff --git a/README.md b/README.md index e2ed719..c0c6641 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This project require at least CMake 3.23 to build. We suggest that you only use See documentation for how to build this project. -> [!INFO] +> [!NOTE] > When building with testbench, you may face link error with GoogleTest. This issue is caused by that the binary provided by your package manager is built in C++ 17 and its ABI is incompatible with C++ 23. The solution is that download GoogleTest source code and build it in C++ 23 on your own. See this [GitHub Issue](https://github.com/google/googletest/issues/4591) for more infomation. > Oppositely, you don't need care about this issue if you just want to build YYCC self. diff --git a/src/YYCCLegacy/StdPatch.cpp b/src/YYCCLegacy/StdPatch.cpp deleted file mode 100644 index b0bfe4a..0000000 --- a/src/YYCCLegacy/StdPatch.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "StdPatch.hpp" - -#include "EncodingHelper.hpp" -#include -#include - -namespace YYCC::StdPatch { - -} diff --git a/src/YYCCLegacy/StdPatch.hpp b/src/YYCCLegacy/StdPatch.hpp deleted file mode 100644 index d67fdf1..0000000 --- a/src/YYCCLegacy/StdPatch.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "YYCCInternal.hpp" - -#include -#include -#include - -namespace YYCC::StdPatch { - - /** - * @brief Constructs \c std::filesystem::path from UTF8 path. - * @param[in] u8_path UTF8 path string for building. - * @return \c std::filesystem::path instance. - * @exception std::invalid_argument Fail to parse given UTF8 string (maybe invalid?). - */ - std::filesystem::path ToStdPath(const yycc_u8string_view& u8_path); - - /** - * @brief Returns the UTF8 representation of given \c std::filesystem::path. - * @param[in] path The \c std::filesystem::path instance converting to UTF8 path. - * @return The UTF8 representation of given \c std::filesystem::path. - * @exception std::invalid_argument Fail to convert to UTF8 string. - */ - yycc_u8string ToUTF8Path(const std::filesystem::path& path); - -} diff --git a/testbench/CMakeLists.txt b/testbench/CMakeLists.txt index e4e97e4..269ab3d 100644 --- a/testbench/CMakeLists.txt +++ b/testbench/CMakeLists.txt @@ -4,6 +4,7 @@ add_executable(YYCCTestbench "") target_sources(YYCCTestbench PRIVATE main.cpp + yycc/macro/version_cmp.cpp yycc/constraint.cpp yycc/constraint/builder.cpp yycc/string/op.cpp diff --git a/testbench/yycc/macro/version_cmp.cpp b/testbench/yycc/macro/version_cmp.cpp new file mode 100644 index 0000000..d1bc89e --- /dev/null +++ b/testbench/yycc/macro/version_cmp.cpp @@ -0,0 +1,31 @@ +#include +#include +#include + +namespace yycctest::macro::version_cmp { + + TEST(MacroVersionCmp, Same) { + // Test for same version. + EXPECT_TRUE(YYCC_VERCMP_E(1, 2, 3, 1, 2, 3)); + EXPECT_FALSE(YYCC_VERCMP_NE(1, 2, 3, 1, 2, 3)); + EXPECT_FALSE(YYCC_VERCMP_G(1, 2, 3, 1, 2, 3)); + EXPECT_TRUE(YYCC_VERCMP_GE(1, 2, 3, 1, 2, 3)); + EXPECT_TRUE(YYCC_VERCMP_NL(1, 2, 3, 1, 2, 3)); + EXPECT_FALSE(YYCC_VERCMP_L(1, 2, 3, 1, 2, 3)); + EXPECT_TRUE(YYCC_VERCMP_LE(1, 2, 3, 1, 2, 3)); + EXPECT_TRUE(YYCC_VERCMP_NG(1, 2, 3, 1, 2, 3)); + } + + TEST(MacroVersionCmp, Math) { + // In version number, 1.2.10 is greater than 1.2.9 + EXPECT_FALSE(YYCC_VERCMP_E(1, 2, 10, 1, 2, 9)); + EXPECT_TRUE(YYCC_VERCMP_NE(1, 2, 10, 1, 2, 9)); + EXPECT_TRUE(YYCC_VERCMP_G(1, 2, 10, 1, 2, 9)); + EXPECT_TRUE(YYCC_VERCMP_GE(1, 2, 10, 1, 2, 9)); + EXPECT_TRUE(YYCC_VERCMP_NL(1, 2, 10, 1, 2, 9)); + EXPECT_FALSE(YYCC_VERCMP_L(1, 2, 10, 1, 2, 9)); + EXPECT_FALSE(YYCC_VERCMP_LE(1, 2, 10, 1, 2, 9)); + EXPECT_FALSE(YYCC_VERCMP_NG(1, 2, 10, 1, 2, 9)); + } + +}