Improve GAsyncQueue test coverage
authorMatthias Clasen <mclasen@redhat.com>
Mon, 30 Dec 2013 14:49:30 +0000 (09:49 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 1 Jan 2014 22:59:22 +0000 (17:59 -0500)
glib/tests/asyncqueue.c

index fce411b..5ccbb23 100644 (file)
@@ -204,6 +204,19 @@ test_async_queue_timed (void)
   g_assert_cmpint (diff, >=, G_USEC_PER_SEC / 10);
   g_assert_cmpint (diff, <, G_USEC_PER_SEC);
 
+  start = end;
+  g_get_current_time (&tv);
+  g_time_val_add (&tv, G_USEC_PER_SEC / 10);
+  g_async_queue_lock (q);
+  val = g_async_queue_timed_pop_unlocked (q, &tv);
+  g_async_queue_unlock (q);
+  g_assert (val == NULL);
+
+  end = g_get_monotonic_time ();
+  diff = end - start;
+  g_assert_cmpint (diff, >=, G_USEC_PER_SEC / 10);
+  g_assert_cmpint (diff, <, G_USEC_PER_SEC);
+
   g_async_queue_unref (q);
 }