[glib] Test glib_check_version



commit a2f4564fd9bee001e6b4d60df257ab6b2110f22f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 20 23:07:39 2010 -0400

    Test glib_check_version

 glib/tests/utils.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/utils.c b/glib/tests/utils.c
index 7613d03..e402751 100644
--- a/glib/tests/utils.c
+++ b/glib/tests/utils.c
@@ -72,6 +72,29 @@ test_language_names (void)
                         NULL));
 }
 
+static void
+test_version (void)
+{
+  g_assert (glib_check_version (GLIB_MAJOR_VERSION,
+                                GLIB_MINOR_VERSION,
+                                GLIB_MICRO_VERSION) == NULL);
+  g_assert (glib_check_version (GLIB_MAJOR_VERSION,
+                                GLIB_MINOR_VERSION,
+                                0) == NULL);
+  g_assert (glib_check_version (GLIB_MAJOR_VERSION - 1,
+                                0,
+                                0) != NULL);
+  g_assert (glib_check_version (GLIB_MAJOR_VERSION + 1,
+                                0,
+                                0) != NULL);
+  g_assert (glib_check_version (GLIB_MAJOR_VERSION,
+                                GLIB_MINOR_VERSION + 1,
+                                0) != NULL);
+  g_assert (glib_check_version (GLIB_MAJOR_VERSION,
+                                GLIB_MINOR_VERSION,
+                                GLIB_MICRO_VERSION + 1) != NULL);
+}
+
 int
 main (int   argc,
       char *argv[])
@@ -79,6 +102,7 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
 
   g_test_add_func ("/utils/language-names", test_language_names);
+  g_test_add_func ("/utils/version", test_version);
 
   return g_test_run();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]