summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2000-01-14 05:18:38 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-01-14 05:18:38 +0000
commit8f820da276d9f5aa03271879e62c29d3bc8eac1e (patch)
tree6b6a456e739ddcc503c8824b6aca80dc93640317 /tests
parentc1e581a52311cd5e0698af8399347b302f0ade05 (diff)
downloadgconf-8f820da276d9f5aa03271879e62c29d3bc8eac1e.tar.gz
function to generate a pseudo-random very-very-likely-to-be-unique key
2000-01-13 Havoc Pennington <hp@pobox.com> * gconf/gconf.c (gconf_unique_key): function to generate a pseudo-random very-very-likely-to-be-unique key name.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/testunique.c46
2 files changed, 51 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f3a6c3fd..fb45f955 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,7 +4,11 @@ EFENCE=
INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(includedir) $(ORBIT_CFLAGS) $(GLIB_CFLAGS) \
-DG_LOG_DOMAIN=\"GConf-Tests\" -DGCONF_ENABLE_INTERNALS=1
-noinst_PROGRAMS=testgconf testlisteners testschemas testchangeset testencode
+noinst_PROGRAMS=testgconf testlisteners testschemas testchangeset testencode testunique
+
+testunique_SOURCES=testunique.c
+
+testunique_LDADD = $(ORBIT_LIBS) $(GLIB_LIBS) $(top_builddir)/gconf/libgconf.la $(EFENCE)
testgconf_SOURCES=testgconf.c
diff --git a/tests/testunique.c b/tests/testunique.c
new file mode 100644
index 00000000..53324e54
--- /dev/null
+++ b/tests/testunique.c
@@ -0,0 +1,46 @@
+/* GConf
+ * Copyright (C) 1999, 2000 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* This isn't an automated test */
+
+#include <gconf/gconf.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <math.h>
+
+int
+main (int argc, char** argv)
+{
+ guint i = 0;
+
+ while (i < 50)
+ {
+ gchar* key;
+
+ key = gconf_unique_key();
+
+ printf("key: %s\n", key);
+
+ g_free(key);
+
+ ++i;
+ }
+
+ return 0;
+}