Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools/Tools.tests.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-11-14 22:42:54 +0300
committerLeitwolf112026-11-14 22:42:54 +0300
commite2905c736cf2e36965c071c21bc7911eb3c59a7b (patch)
tree537504b761ed21b6fe821aebbbf9eab6b398d054 /tools/Tools.tests.cpp
parent2d21d2e0f9c6e0789e9c55d6cba611234dc61a60 (diff)
downloadcatch3-e2905c736cf2e36965c071c21bc7911eb3c59a7b.tar.gz
Refuse a next patch past the largest numberfix/version-tool-semver
NextPatch added one to the patch without a check, so a patch at std::numeric_limits<unsigned>::max() wrapped to 0 and --next would have moved the version back. It returns nothing there now; tests cover a three- and a four-number version at the limit. Claude-Session: https://claude.ai/code/session_01Ji7xZMYjc4zankoc7hGBE1
Diffstat (limited to 'tools/Tools.tests.cpp')
-rw-r--r--tools/Tools.tests.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/Tools.tests.cpp b/tools/Tools.tests.cpp
index 980d9e7a..c505b966 100644
--- a/tools/Tools.tests.cpp
+++ b/tools/Tools.tests.cpp
@@ -3,6 +3,7 @@
#include <Progmasoft/Catch3/Matchers/String.hpp>
#include <Progmasoft/Catch3/TestMacros.hpp>
+#include <limits>
#include <string>
#include "tools/Amalgamation.hpp"
@@ -38,6 +39,9 @@ TEST_CASE("The next patch release follows a SemVer or a four-number version",
// After the four-number versions: the fourth number goes.
CHECK(next("0.3.0.2") == "0.3.1");
CHECK(next("0.3") == "none");
+ const auto largest = std::to_string(std::numeric_limits<unsigned>::max());
+ CHECK(next(("0.4." + largest).c_str()) == "none");
+ CHECK(next(("0.3." + largest + ".2").c_str()) == "none");
CHECK(next("0.3.0.2.1") == "none");
}