[glib] GVariant test: test parsing of "inf" and "nan"



commit cd35e2e64341c7d8186f448e990e6589f0b21d64
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Mar 31 15:09:55 2011 +0530

    GVariant test: test parsing of "inf" and "nan"

 glib/tests/gvariant.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 7fc96e5..49860e4 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -3662,6 +3662,23 @@ test_parses (void)
     g_free (printed);
   }
 
+  /* inf/nan mini test */
+  {
+    const gchar *tests[] = { "inf", "-inf", "nan" };
+    GVariant *value;
+    gchar *printed;
+    gint i;
+
+    for (i = 0; i < G_N_ELEMENTS (tests); i++)
+      {
+        GError *error = NULL;
+        value = g_variant_parse (NULL, tests[i], NULL, NULL, &error);
+        printed = g_variant_print (value, FALSE);
+        g_assert_cmpstr (tests[i], ==, printed);
+        g_free (printed);
+      }
+  }
+
   g_variant_type_info_assert_no_infos ();
 }
 



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