+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
+Sat Jan 9 15:08:44 1999 Jeff Garzik <jgarzik@pobox.com>
+
+ * testglib.c:
+ Make all aux functions static.
+
+ * tests/Makefile.am, tests/dirname-test.c, tests/type-test.c:
+ New tests dirname-test and type-test, from testglib.
+
Sat Jan 9 13:53:00 1999 Jeff Garzik <jgarzik@pobox.com>
* configure.in:
g_print ("ok\n");
}
-gboolean
+static gboolean
my_hash_callback_remove (gpointer key,
gpointer value,
gpointer user_data)
return FALSE;
}
-void
+static void
my_hash_callback_remove_test (gpointer key,
gpointer value,
gpointer user_data)
g_print ("bad!\n");
}
-void
+static void
my_hash_callback (gpointer key,
gpointer value,
gpointer user_data)
*d = 1;
}
-guint
+static guint
my_hash (gconstpointer key)
{
return (guint) *((const gint*) key);
}
-gint
+static gint
my_hash_compare (gconstpointer a,
gconstpointer b)
{
return *((const gint*) a) == *((const gint*) b);
}
-gint
+static gint
my_list_compare_one (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
return one-two;
}
-gint
+static gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
return two-one;
}
-/* void
+/* static void
my_list_print (gpointer a, gpointer b)
{
gint three = *((gint*)a);
g_print("%d", three);
}; */
-gint
+static gint
my_compare (gconstpointer a,
gconstpointer b)
{
return *cha - *chb;
}
-gint
+static gint
my_traverse (gpointer key,
gpointer value,
gpointer data)
string-test
array-test
tree-test
+dirname-test
+type-test
TESTS = \
alloca-test \
array-test \
+ dirname-test \
hash-test \
list-test \
node-test \
relation-test \
slist-test \
string-test \
- tree-test
+ tree-test \
+ type-test
noinst_PROGRAMS = $(TESTS)
alloca_test_LDADD = $(top_builddir)/libglib.la
array_test_LDADD = $(top_builddir)/libglib.la
+dirname_test_LDADD = $(top_builddir)/libglib.la
hash_test_LDADD = $(top_builddir)/libglib.la
list_test_LDADD = $(top_builddir)/libglib.la
node_test_LDADD = $(top_builddir)/libglib.la
slist_test_LDADD = $(top_builddir)/libglib.la
string_test_LDADD = $(top_builddir)/libglib.la
tree_test_LDADD = $(top_builddir)/libglib.la
+type_test_LDADD = $(top_builddir)/libglib.la
--- /dev/null
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+#undef G_LOG_DOMAIN
+
+#include <stdio.h>
+#include <string.h>
+#include "glib.h"
+
+int array[10000];
+gboolean failed = FALSE;
+
+#define TEST(m,cond) G_STMT_START { failed = !(cond); \
+if (failed) \
+ { if (!m) \
+ g_print ("\n(%s:%d) failed for: %s\n", __FILE__, __LINE__, ( # cond )); \
+ else \
+ g_print ("\n(%s:%d) failed for: %s: (%s)\n", __FILE__, __LINE__, ( # cond ), (gchar*)m); \
+ } \
+else \
+ g_print ("."); fflush (stdout); \
+} G_STMT_END
+
+#define C2P(c) ((gpointer) ((long) (c)))
+#define P2C(p) ((gchar) ((long) (p)))
+
+#define GLIB_TEST_STRING "el dorado "
+#define GLIB_TEST_STRING_5 "el do"
+
+int
+main (int argc,
+ char *argv[])
+{
+ gint i;
+ struct {
+ gchar *filename;
+ gchar *dirname;
+ } dirname_checks[] = {
+#ifndef NATIVE_WIN32
+ { "/", "/" },
+ { "////", "/" },
+ { ".////", "." },
+ { ".", "." },
+ { "..", "." },
+ { "../", ".." },
+ { "..////", ".." },
+ { "", "." },
+ { "a/b", "a" },
+ { "a/b/", "a/b" },
+ { "c///", "c" },
+#else
+ { "\\", "\\" },
+ { ".\\\\\\\\", "." },
+ { ".", "." },
+ { "..", "." },
+ { "..\\", ".." },
+ { "..\\\\\\\\", ".." },
+ { "", "." },
+ { "a\\b", "a" },
+ { "a\\b\\", "a\\b" },
+ { "c\\\\\\", "c" },
+#endif
+ };
+ guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]);
+
+ for (i = 0; i < n_dirname_checks; i++)
+ {
+ gchar *dirname;
+
+ dirname = g_dirname (dirname_checks[i].filename);
+ g_assert (strcmp (dirname, dirname_checks[i].dirname) == 0);
+ g_free (dirname);
+ }
+
+ return 0;
+}
+
g_print ("ok\n");
}
-gboolean
+static gboolean
my_hash_callback_remove (gpointer key,
gpointer value,
gpointer user_data)
return FALSE;
}
-void
+static void
my_hash_callback_remove_test (gpointer key,
gpointer value,
gpointer user_data)
g_print ("bad!\n");
}
-void
+static void
my_hash_callback (gpointer key,
gpointer value,
gpointer user_data)
*d = 1;
}
-guint
+static guint
my_hash (gconstpointer key)
{
return (guint) *((const gint*) key);
}
-gint
+static gint
my_hash_compare (gconstpointer a,
gconstpointer b)
{
return *((const gint*) a) == *((const gint*) b);
}
-gint
+static gint
my_list_compare_one (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
return one-two;
}
-gint
+static gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
return two-one;
}
-/* void
+/* static void
my_list_print (gpointer a, gpointer b)
{
gint three = *((gint*)a);
g_print("%d", three);
}; */
-gint
+static gint
my_compare (gconstpointer a,
gconstpointer b)
{
return *cha - *chb;
}
-gint
+static gint
my_traverse (gpointer key,
gpointer value,
gpointer data)
--- /dev/null
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * 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.
+ */
+#undef G_LOG_DOMAIN
+
+#include <stdio.h>
+#include <string.h>
+#include "glib.h"
+
+
+
+int
+main (int argc,
+ char *argv[])
+{
+ guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U;
+ guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U;
+#ifdef G_HAVE_GINT64
+ guint64 gu64t1 = G_GINT64_CONSTANT(0x1d636b02300a7aa7U),
+ gu64t2 = G_GINT64_CONSTANT(0xa77a0a30026b631dU);
+#endif
+
+ /* type sizes */
+ g_assert (sizeof (gint8) == 1);
+ g_assert (sizeof (gint16) == 2);
+ g_assert (sizeof (gint32) == 4);
+#ifdef G_HAVE_GINT64
+ g_assert (sizeof (gint64) == 8);
+#endif /* G_HAVE_GINT64 */
+
+ g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2);
+ g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2);
+#ifdef G_HAVE_GINT64
+ g_assert (GUINT64_SWAP_LE_BE (gu64t1) == gu64t2);
+#endif
+
+ return 0;
+}