[telepathy-glib/master] Add a test for tp_value_array_build

Sjoerd Simons sjoerd.simons at collabora.co.uk
Thu Nov 19 06:18:57 PST 2009


---
 tests/util.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/tests/util.c b/tests/util.c
index d4b67f1..0c09456 100644
--- a/tests/util.c
+++ b/tests/util.c
@@ -21,11 +21,33 @@ test_strv_contains (void)
   g_assert (!tp_strv_contains (strv, "Snakes!"));
 }
 
+static void
+test_value_array_build (void)
+{
+  GValueArray *arr;
+  const gchar *host = "badger.snakes";
+  guint port = 128;
+
+  arr = tp_value_array_build (2,
+    G_TYPE_STRING, host,
+    G_TYPE_UINT, port,
+    G_TYPE_INVALID);
+
+  g_assert (!tp_strdiff (g_value_get_string (g_value_array_get_nth (arr, 0)),
+    host));
+
+  g_assert (g_value_get_uint (g_value_array_get_nth (arr, 1)) == port);
+
+  g_value_array_free (arr);
+}
+
 int main (int argc, char **argv)
 {
   GPtrArray *ptrarray;
   gchar *string;
 
+  g_type_init ();
+
   g_assert (!tp_strdiff (NULL, NULL));
   g_assert (tp_strdiff ("badger", NULL));
   g_assert (tp_strdiff (NULL, "badger"));
@@ -54,5 +76,7 @@ int main (int argc, char **argv)
 
   test_strv_contains ();
 
+  test_value_array_build ();
+
   return 0;
 }
-- 
1.5.6.5



More information about the telepathy-commits mailing list