[libdazzle] tests: use GRand
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] tests: use GRand
- Date: Wed, 12 Jul 2017 21:00:15 +0000 (UTC)
commit 07c0385bcd8e0be69017ee12eb43a813aeb547fa
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 12 13:59:34 2017 -0700
tests: use GRand
We should at least use srand(), but we can just use GRand and
let it handle seeding for us.
tests/test-list-store.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/tests/test-list-store.c b/tests/test-list-store.c
index 06ad64e..1260317 100644
--- a/tests/test-list-store.c
+++ b/tests/test-list-store.c
@@ -1,6 +1,8 @@
#include <dazzle.h>
#include <stdlib.h>
+static GRand *grand;
+
static gint
compare_direct (gconstpointer a,
gconstpointer b,
@@ -31,7 +33,7 @@ test_insert_sorted (void)
for (guint i = 0; i < 1000; i++)
{
- gpointer value = GINT_TO_POINTER (rand ());
+ gpointer value = GINT_TO_POINTER (g_rand_int (grand));
dzl_gtk_list_store_insert_sorted (store, &iter, value, 0, compare_direct, NULL);
gtk_list_store_set (store, &iter, 0, value, -1);
@@ -61,6 +63,7 @@ gint
main (gint argc,
gchar *argv[])
{
+ grand = g_rand_new ();
gtk_init (&argc, &argv);
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/Dazzle/GtkListStore/insert_sorted", test_insert_sorted);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]