From 5eab9121e8ea2bc6d310fa1bfe450e2b68382106 Mon Sep 17 00:00:00 2001 From: Gonzalo Diaz Date: Tue, 2 Sep 2025 17:01:30 -0400 Subject: [PATCH 1/2] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a631aea..b112855 100644 --- a/README.md +++ b/README.md @@ -176,8 +176,8 @@ g++ --version ``` ```text -Apple clang version 15.0.0 (clang-1500.3.9.4) -Target: x86_64-apple-darwin23.6.0 +Apple clang version 17.0.0 (clang-1700.0.13.5) +Target: x86_64-apple-darwin24.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ``` @@ -189,7 +189,7 @@ cppcheck --version ``` ```text -Cppcheck 2.15.0 +Cppcheck 2.18.0 ``` ## Algorithm excersices sources From b6b4d074c2ddce178351cdb2c767bb1107d71ed2 Mon Sep 17 00:00:00 2001 From: "codecov-ai[bot]" <156709835+codecov-ai[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 21:15:41 +0000 Subject: [PATCH 2/2] test: add unit tests for PR#97 --- .../documentation/readme_validation.test.cpp | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/tests/unit/documentation/readme_validation.test.cpp diff --git a/src/tests/unit/documentation/readme_validation.test.cpp b/src/tests/unit/documentation/readme_validation.test.cpp new file mode 100644 index 0000000..b9a4623 --- /dev/null +++ b/src/tests/unit/documentation/readme_validation.test.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include + +namespace { + std::string readFileContent(const std::string& filepath) { + std::ifstream file(filepath); + if (!file.is_open()) { + throw std::runtime_error("Could not open file: " + filepath); + } + + std::string content; + std::string line; + while (std::getline(file, line)) { + content += line + "\n"; + } + return content; + } +} + +TEST_CASE("README.md contains expected Apple clang version", "[documentation] [readme]") { + std::string readmePath = "README.md"; + + // Check if file exists + REQUIRE(std::filesystem::exists(readmePath)); + + std::string content = readFileContent(readmePath); + + // Test that the updated Apple clang version is present + REQUIRE(content.find("Apple clang version 17.0.0 (clang-1700.0.13.5)") != std::string::npos); + + // Test that the old version is NOT present + REQUIRE(content.find("Apple clang version 15.0.0 (clang-1500.3.9.4)") == std::string::npos); +} + +TEST_CASE("README.md contains expected target architecture", "[documentation] [readme]") { + std::string readmePath = "README.md"; + + // Check if file exists + REQUIRE(std::filesystem::exists(readmePath)); + + std::string content = readFileContent(readmePath); + + // Test that the updated target architecture is present + REQUIRE(content.find("Target: x86_64-apple-darwin24.6.0") != std::string::npos); + + // Test that the old target architecture is NOT present + REQUIRE(content.find("Target: x86_64-apple-darwin23.6.0") == std::string::npos); +} + +TEST_CASE("README.md contains expected Cppcheck version", "[documentation] [readme]") { + std::string readmePath = "README.md"; + + // Check if file exists + REQUIRE(std::filesystem::exists(readmePath)); + + std::string content = readFileContent(readmePath); + + // Test that the updated Cppcheck version is present + REQUIRE(content.find("Cppcheck 2.18.0") != std::string::npos); + + // Test that the old version is NOT present + REQUIRE(content.find("Cppcheck 2.15.0") == std::string::npos); +} + +TEST_CASE("README.md version information format validation", "[documentation] [readme]") { + std::string readmePath = "README.md"; + + // Check if file exists + REQUIRE(std::filesystem::exists(readmePath)); + + std::string content = readFileContent(readmePath); + + // Validate Apple clang version format using regex + std::regex clang_pattern(R"(Apple clang version \d+\.\d+\.\d+ \(clang-\d+\.\d+\.\d+\.\d+\))"); + REQUIRE(std::regex_search(content, clang_pattern)); + + // Validate Cppcheck version format using regex + std::regex cppcheck_pattern(R"(Cppcheck \d+\.\d+\.\d+)"); + REQUIRE(std::regex_search(content, cppcheck_pattern)); +} \ No newline at end of file