summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@src.gnome.org>1999-01-09 20:10:45 +0000
committerJeff Garzik <jgarzik@src.gnome.org>1999-01-09 20:10:45 +0000
commit5eeca0d62d4b3290bf9104c9f2dce71206d1b7fd (patch)
tree36f2894891e7cb979abfbbdceb2078464a2c1015
parent2a6789be13c4def678ae612d6cdf236d347374eb (diff)
downloadglib-5eeca0d62d4b3290bf9104c9f2dce71206d1b7fd.tar.gz
Make all aux functions static.
* 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.
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-128
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--testglib.c20
-rw-r--r--tests/.cvsignore2
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/dirname-test.c92
-rw-r--r--tests/testglib.c20
-rw-r--r--tests/type-test.c53
14 files changed, 236 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+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:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 2e97a6f45..17a91e0cf 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+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:
diff --git a/testglib.c b/testglib.c
index 50ec6fb34..8cc315c89 100644
--- a/testglib.c
+++ b/testglib.c
@@ -185,7 +185,7 @@ g_node_test (void)
g_print ("ok\n");
}
-gboolean
+static gboolean
my_hash_callback_remove (gpointer key,
gpointer value,
gpointer user_data)
@@ -198,7 +198,7 @@ my_hash_callback_remove (gpointer key,
return FALSE;
}
-void
+static void
my_hash_callback_remove_test (gpointer key,
gpointer value,
gpointer user_data)
@@ -209,7 +209,7 @@ my_hash_callback_remove_test (gpointer key,
g_print ("bad!\n");
}
-void
+static void
my_hash_callback (gpointer key,
gpointer value,
gpointer user_data)
@@ -218,20 +218,20 @@ my_hash_callback (gpointer key,
*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);
@@ -239,7 +239,7 @@ my_list_compare_one (gconstpointer a, gconstpointer b)
return one-two;
}
-gint
+static gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
@@ -247,14 +247,14 @@ my_list_compare_two (gconstpointer a, gconstpointer b)
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)
{
@@ -264,7 +264,7 @@ my_compare (gconstpointer a,
return *cha - *chb;
}
-gint
+static gint
my_traverse (gpointer key,
gpointer value,
gpointer data)
diff --git a/tests/.cvsignore b/tests/.cvsignore
index 007e6463f..b23a68aee 100644
--- a/tests/.cvsignore
+++ b/tests/.cvsignore
@@ -31,3 +31,5 @@ slist-test
string-test
array-test
tree-test
+dirname-test
+type-test
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5b2207912..b648df8de 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,18 +4,21 @@ INCLUDES = -I$(top_srcdir)
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
@@ -23,4 +26,5 @@ relation_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
diff --git a/tests/dirname-test.c b/tests/dirname-test.c
new file mode 100644
index 000000000..2395e623d
--- /dev/null
+++ b/tests/dirname-test.c
@@ -0,0 +1,92 @@
+/* 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;
+}
+
diff --git a/tests/testglib.c b/tests/testglib.c
index 50ec6fb34..8cc315c89 100644
--- a/tests/testglib.c
+++ b/tests/testglib.c
@@ -185,7 +185,7 @@ g_node_test (void)
g_print ("ok\n");
}
-gboolean
+static gboolean
my_hash_callback_remove (gpointer key,
gpointer value,
gpointer user_data)
@@ -198,7 +198,7 @@ my_hash_callback_remove (gpointer key,
return FALSE;
}
-void
+static void
my_hash_callback_remove_test (gpointer key,
gpointer value,
gpointer user_data)
@@ -209,7 +209,7 @@ my_hash_callback_remove_test (gpointer key,
g_print ("bad!\n");
}
-void
+static void
my_hash_callback (gpointer key,
gpointer value,
gpointer user_data)
@@ -218,20 +218,20 @@ my_hash_callback (gpointer key,
*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);
@@ -239,7 +239,7 @@ my_list_compare_one (gconstpointer a, gconstpointer b)
return one-two;
}
-gint
+static gint
my_list_compare_two (gconstpointer a, gconstpointer b)
{
gint one = *((const gint*)a);
@@ -247,14 +247,14 @@ my_list_compare_two (gconstpointer a, gconstpointer b)
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)
{
@@ -264,7 +264,7 @@ my_compare (gconstpointer a,
return *cha - *chb;
}
-gint
+static gint
my_traverse (gpointer key,
gpointer value,
gpointer data)
diff --git a/tests/type-test.c b/tests/type-test.c
new file mode 100644
index 000000000..1e39484c7
--- /dev/null
+++ b/tests/type-test.c
@@ -0,0 +1,53 @@
+/* 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;
+}