From 2f60608e3cd3ccca22b0e211a056c4f7d2c128d1 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Tue, 5 Jul 2022 09:57:47 +0200 Subject: [PATCH] tests: Modify tests to include hidden problems The previous test cases didn't actually cover the majority of use cases at all. --- tests/CMakeLists.txt | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7cd2c32..e69e76d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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")