summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalev Lember <klember@redhat.com>2019-01-04 12:43:05 +0100
committerKalev Lember <klember@redhat.com>2019-01-04 12:44:56 +0100
commit83915db0b30f7093ee8250110bd3a4ff6a96d7f0 (patch)
treeace3cec532ff12a329069caaf68b83251a09b9e6
parent584faccb9e1de36265af78064e1b7ef32d4d59a3 (diff)
downloadappstream-glib-83915db0b30f7093ee8250110bd3a4ff6a96d7f0.tar.gz
Add tests for as_util_vercmp_full()
https://github.com/hughsie/appstream-glib/issues/270
-rw-r--r--libappstream-glib/as-self-test.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c
index 981b790..0e77088 100644
--- a/libappstream-glib/as-self-test.c
+++ b/libappstream-glib/as-self-test.c
@@ -5066,6 +5066,14 @@ as_test_utils_vercmp_func (void)
g_assert_cmpint (as_utils_vercmp ("1", NULL), ==, G_MAXINT);
g_assert_cmpint (as_utils_vercmp (NULL, "1"), ==, G_MAXINT);
g_assert_cmpint (as_utils_vercmp (NULL, NULL), ==, G_MAXINT);
+
+ /* full version gets some more checks right */
+ g_assert_cmpint (as_utils_vercmp_full ("0.9", "1", AS_VERSION_COMPARE_FLAG_NONE), <, 0);
+ g_assert_cmpint (as_utils_vercmp_full ("9", "9a", AS_VERSION_COMPARE_FLAG_NONE), <, 0);
+ g_assert_cmpint (as_utils_vercmp_full ("9a", "10", AS_VERSION_COMPARE_FLAG_NONE), <, 0);
+ g_assert_cmpint (as_utils_vercmp_full ("9+", "10", AS_VERSION_COMPARE_FLAG_NONE), <, 0);
+ g_assert_cmpint (as_utils_vercmp_full ("9half", "10", AS_VERSION_COMPARE_FLAG_NONE), <, 0);
+ g_assert_cmpint (as_utils_vercmp_full ("9.5", "10", AS_VERSION_COMPARE_FLAG_NONE), <, 0);
}
static void