Test glib_check_version
authorMatthias Clasen <mclasen@redhat.com>
Mon, 21 Jun 2010 03:07:39 +0000 (23:07 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 21 Jun 2010 03:07:39 +0000 (23:07 -0400)
glib/tests/utils.c

index 7613d0347e3ed10038323405673247790828a2b1..e4027511f58ed2045d9c2211a04b282d4ca2fd84 100644 (file)
@@ -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();
 }