From 8f820da276d9f5aa03271879e62c29d3bc8eac1e Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 14 Jan 2000 05:18:38 +0000 Subject: function to generate a pseudo-random very-very-likely-to-be-unique key 2000-01-13 Havoc Pennington * gconf/gconf.c (gconf_unique_key): function to generate a pseudo-random very-very-likely-to-be-unique key name. --- tests/Makefile.am | 6 +++++- tests/testunique.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/testunique.c (limited to 'tests') 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 +#include +#include +#include + +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; +} -- cgit v1.2.1