tests: Modify tests to include hidden problems

The previous test cases didn't actually cover the majority of use cases at all.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2022-07-05 09:57:47 +02:00
parent 6d978a044e
commit 2f60608e3c
+22 -17
View File
@@ -63,23 +63,23 @@ test_parse("0.0.0+.0" FAIL)
# Modifying
message(STATUS "\n\n===== Modifying =====")
# - Valid Cases
test_modify("1.0" "0.0" MAJOR 1)
test_modify("1.0" "0.0" MAJOR "+1")
test_modify("1.0" "2.0" MAJOR "-1")
test_modify("0.2" "0.0" MINOR 2)
test_modify("0.2" "0.0" MINOR "+2")
test_modify("0.2" "0.3" MINOR "-1")
test_modify("0.0.3" "0.0" PATCH 3)
test_modify("0.0.3" "0.0.2" PATCH "+1")
test_modify("0.0.3" "0.0.4" PATCH "-1")
test_modify("0.0.0.4" "0.0" TWEAK 4)
test_modify("0.0.0.4" "0.0.0.3" TWEAK "+1")
test_modify("0.0.0.4" "0.0.0.5" TWEAK "-1")
test_modify("0.0-5" "0.0" COMPRESS PRERELEASE 5)
test_modify("0.0a5" "0.0" COMPRESS PRERELEASE a5)
test_modify("0.0+6" "0.0" COMPRESS BUILD 6)
test_modify("0.0-5+6" "0.0" COMPRESS PRERELEASE 5 BUILD 6)
test_modify("0.0a5+6" "0.0" COMPRESS PRERELEASE a5 BUILD 6)
test_modify("1.2" "0.2" MAJOR 1)
test_modify("1.2" "0.2" MAJOR "+1")
test_modify("1.2" "2.2" MAJOR "-1")
test_modify("1.2" "1.0" MINOR 2)
test_modify("1.2" "1.0" MINOR "+2")
test_modify("1.2" "1.3" MINOR "-1")
test_modify("1.2.3" "1.2" PATCH 3)
test_modify("1.2.3" "1.2.2" PATCH "+1")
test_modify("1.2.3" "1.2.4" PATCH "-1")
test_modify("1.2.0.4" "1.2" TWEAK 4)
test_modify("1.2.3.4" "1.2.3.3" TWEAK "+1")
test_modify("1.2.3.4" "1.2.3.5" TWEAK "-1")
test_modify("1.2-5" "1.2" COMPRESS PRERELEASE 5)
test_modify("1.2a5" "1.2" COMPRESS PRERELEASE a5)
test_modify("1.2+6" "1.2" COMPRESS BUILD 6)
test_modify("1.2-5+6" "1.2" COMPRESS PRERELEASE 5 BUILD 6)
test_modify("1.2a5+6" "1.2" COMPRESS PRERELEASE a5 BUILD 6)
# - Invalid Cases
test_modify("0.0" "0.0" FAIL MAJOR -1)
test_modify("0.0" "0.0" FAIL MINOR -1)
@@ -111,3 +111,8 @@ test_compare("0.0-5" "+PRERELEASE" "0.0")
test_compare("0.0" "-PRERELEASE" "0.0-5")
test_compare("0.0+6" "+BUILD" "0.0")
test_compare("0.0" "-BUILD" "0.0+6")
# Discovered failure cases
message(STATUS "\n\n===== User-generated Cases =====")
test_generate("1.2.3.4+gABCDEF01" MAJOR 1 MINOR 2 PATCH 3 TWEAK 4 BUILD "gABCDEF01")
test_modify("0.2.0.4+gABCDEF01" "0.2.0" TWEAK "4" BUILD "gABCDEF01")