glib r7419 - in trunk: . glib/tests tests



Author: pborelli
Date: Mon Sep  1 09:31:40 2008
New Revision: 7419
URL: http://svn.gnome.org/viewvc/glib?rev=7419&view=rev

Log:
2008-09-01  Paolo Borelli  <pborelli katamail com>

	Bug 550040 - Move GString, rand and printf tests to the unit test
	framework

	* tests/printf-test.c:
	* tests/rand-test.c:
	* tests/string-test.c:
	Removed

	* glib/tests/printf.c:
	* glib/tests/rand.c:
	* glib/tests/string.c:
	Added

	* tests/Makefile.am:
	* glib/tests/Makefile.am:
	Updated for the above



Added:
   trunk/glib/tests/printf.c
   trunk/glib/tests/rand.c
   trunk/glib/tests/string.c
Removed:
   trunk/tests/printf-test.c
   trunk/tests/rand-test.c
   trunk/tests/string-test.c
Modified:
   trunk/ChangeLog
   trunk/glib/tests/Makefile.am
   trunk/tests/Makefile.am

Modified: trunk/glib/tests/Makefile.am
==============================================================================
--- trunk/glib/tests/Makefile.am	(original)
+++ trunk/glib/tests/Makefile.am	Mon Sep  1 09:31:40 2008
@@ -22,10 +22,22 @@
 fileutils_SOURCES  = fileutils.c
 fileutils_LDADD	   = $(progs_ldadd)
 
+TEST_PROGS        += printf
+printf_SOURCES       = printf.c
+printf_LDADD	   = $(progs_ldadd) -lm
+
+TEST_PROGS        += rand
+rand_SOURCES       = rand.c
+rand_LDADD	   = $(progs_ldadd) -lm
+
 TEST_PROGS        += strfuncs
 strfuncs_SOURCES   = strfuncs.c
 strfuncs_LDADD	   = $(progs_ldadd) -lm
 
+TEST_PROGS        += string
+string_SOURCES     = string.c
+string_LDADD	   = $(progs_ldadd) -lm
+
 TEST_PROGS               += markup-subparser
 markup_subparser_LDADD    = $(progs_ldadd)
 

Added: trunk/glib/tests/printf.c
==============================================================================
--- (empty file)
+++ trunk/glib/tests/printf.c	Mon Sep  1 09:31:40 2008
@@ -0,0 +1,703 @@
+/* Unit tests for gstring
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work 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.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "glib.h"
+
+static void
+test_retval_and_trunc (void)
+{
+  gchar buf[128];
+  gint res;
+
+  res = g_snprintf (buf, 0, "abc");
+  g_assert_cmpint (res, ==, 3);
+
+  res = g_snprintf (NULL, 0, "abc");
+  g_assert_cmpint (res, ==, 3);
+
+  res = g_snprintf (buf, 5, "abc");
+  g_assert_cmpint (res, ==, 3);
+
+  res = g_snprintf (buf, 1, "abc");
+  g_assert_cmpint (res, ==, 3);
+  g_assert (buf[0] == '\0');
+  g_assert_cmpstr (buf, ==, "");
+
+  res = g_snprintf (buf, 2, "abc");
+  g_assert_cmpint (res, ==, 3);
+  g_assert (buf[1] == '\0');
+  g_assert_cmpstr (buf, ==, "a");
+
+  res = g_snprintf (buf, 3, "abc");
+  g_assert_cmpint (res, ==, 3);
+  g_assert (buf[2] == '\0');
+  g_assert_cmpstr (buf, ==, "ab");
+
+  res = g_snprintf (buf, 4, "abc");
+  g_assert_cmpint (res, ==, 3);
+  g_assert (buf[3] == '\0');
+  g_assert_cmpstr (buf, ==, "abc");
+
+  res = g_snprintf (buf, 5, "abc");
+  g_assert_cmpint (res, ==, 3);
+  g_assert (buf[3] == '\0');
+  g_assert_cmpstr (buf, ==, "abc");
+}
+
+static void
+test_d (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %d basic formatting */
+
+  res = g_snprintf (buf, 128, "%d", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%d", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+
+  res = g_snprintf (buf, 128, "%.0d", 0);
+  g_assert_cmpint (res, ==, 0);
+  g_assert_cmpstr (buf, ==, "");
+
+  res = g_snprintf (buf, 128, "%.0d", 1);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "1");
+
+  res = g_snprintf (buf, 128, "%.d", 2);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "2");
+
+  res = g_snprintf (buf, 128, "%d", -1);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "-1");
+
+  res = g_snprintf (buf, 128, "%.3d", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%.3d", -5);
+  g_assert_cmpint (res, ==, 4);
+  g_assert_cmpstr (buf, ==, "-005");
+
+  res = g_snprintf (buf, 128, "%5.3d", 5);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  005");
+
+  res = g_snprintf (buf, 128, "%-5.3d", -5);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "-005 ");
+
+  /* %d, length modifiers */
+
+  res = g_snprintf (buf, 128, "%" G_GINT16_FORMAT, (gint16)-5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "-5");
+
+  res = g_snprintf (buf, 128, "%" G_GUINT16_FORMAT, (guint16)5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%" G_GINT32_FORMAT, (gint32)-5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "-5");
+
+  res = g_snprintf (buf, 128, "%" G_GUINT32_FORMAT, (guint32)5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%" G_GINT64_FORMAT, (gint64)-5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "-5");
+
+  res = g_snprintf (buf, 128, "%" G_GUINT64_FORMAT, (guint64)5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%" G_GSSIZE_FORMAT, (gssize)-5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "-5");
+
+  res = g_snprintf (buf, 128, "%" G_GSIZE_FORMAT, (gsize)5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  /* %d, flags */
+
+  res = g_snprintf (buf, 128, "%-d", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%-+d", 5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "+5");
+
+  res = g_snprintf (buf, 128, "%+-d", 5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "+5");
+
+  res = g_snprintf (buf, 128, "%+d", -5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "-5");
+
+  res = g_snprintf (buf, 128, "% d", 5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, " 5");
+
+  res = g_snprintf (buf, 128, "% .0d", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, " ");
+
+  res = g_snprintf (buf, 128, "% +d", 5);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "+5");
+
+  res = g_snprintf (buf, 128, "%03d", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%-03d", -5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "-5 ");
+
+  res = g_snprintf (buf, 128, "%03d", -5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "-05");
+}
+
+static void
+test_o (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %o basic formatting */
+
+  res = g_snprintf (buf, 128, "%o", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%o", 8);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "10");
+
+  res = g_snprintf (buf, 128, "%o", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+
+  res = g_snprintf (buf, 128, "%.0o", 0);
+  g_assert_cmpint (res, ==, 0);
+  g_assert_cmpstr (buf, ==, "");
+
+  res = g_snprintf (buf, 128, "%.0o", 1);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "1");
+
+  res = g_snprintf (buf, 128, "%.3o", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%.3o", 8);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "010");
+
+  res = g_snprintf (buf, 128, "%5.3o", 5);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  005");
+}
+
+static void
+test_u (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %u, basic formatting */
+
+  res = g_snprintf (buf, 128, "%u", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%u", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+
+  res = g_snprintf (buf, 128, "%.0u", 0);
+  g_assert_cmpint (res, ==, 0);
+  g_assert_cmpstr (buf, ==, "");
+
+  res = g_snprintf (buf, 128, "%.0u", 1);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "1");
+
+  res = g_snprintf (buf, 128, "%.3u", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%5.3u", 5);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  005");
+}
+
+static void
+test_x (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %x, basic formatting */
+
+  res = g_snprintf (buf, 128, "%x", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%x", 31);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "1f");
+
+  res = g_snprintf (buf, 128, "%x", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+
+  res = g_snprintf (buf, 128, "%.0x", 0);
+  g_assert_cmpint (res, ==, 0);
+  g_assert_cmpstr (buf, ==, "");
+
+  res = g_snprintf (buf, 128, "%.0x", 1);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "1");
+
+  res = g_snprintf (buf, 128, "%.3x", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%.3x", 31);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "01f");
+
+  res = g_snprintf (buf, 128, "%5.3x", 5);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  005");
+
+  /* %x, flags */
+
+  res = g_snprintf (buf, 128, "%-x", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%03x", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%#x", 31);
+  g_assert_cmpint (res, ==, 4);
+  g_assert_cmpstr (buf, ==, "0x1f");
+
+  res = g_snprintf (buf, 128, "%#x", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+}
+
+static void
+test_X (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %X, basic formatting */
+
+  res = g_snprintf (buf, 128, "%X", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%X", 31);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "1F");
+
+  res = g_snprintf (buf, 128, "%X", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+
+  res = g_snprintf (buf, 128, "%.0X", 0);
+  g_assert_cmpint (res, ==, 0);
+  g_assert_cmpstr (buf, ==, "");
+
+  res = g_snprintf (buf, 128, "%.0X", 1);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "1");
+
+  res = g_snprintf (buf, 128, "%.3X", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%.3X", 31);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "01F");
+
+  res = g_snprintf (buf, 128, "%5.3X", 5);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  005");
+
+  /* %X, flags */
+
+  res = g_snprintf (buf, 128, "%-X", 5);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "5");
+
+  res = g_snprintf (buf, 128, "%03X", 5);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "005");
+
+  res = g_snprintf (buf, 128, "%#X", 31);
+  g_assert_cmpint (res, ==, 4);
+  g_assert_cmpstr (buf, ==, "0X1F");
+
+  res = g_snprintf (buf, 128, "%#X", 0);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "0");
+}
+
+static void
+test_f (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %f, basic formattting */
+
+  res = g_snprintf (buf, 128, "%f", G_PI);
+  g_assert_cmpint (res, ==, 8);
+  g_assert (0 == strncmp (buf, "3.14159", 7));
+
+  res = g_snprintf (buf, 128, "%.8f", G_PI);
+  g_assert_cmpint (res, ==, 10);
+  g_assert (0 == strncmp (buf, "3.1415926", 9));
+
+  res = g_snprintf (buf, 128, "%.0f", G_PI);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "3");
+
+  res = g_snprintf (buf, 128, "%1.f", G_PI);
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "3");
+
+  res = g_snprintf (buf, 128, "%3.f", G_PI);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "  3");
+
+  /* %f, flags */
+
+  res = g_snprintf (buf, 128, "%+f", G_PI);
+  g_assert_cmpint (res, ==, 9);
+  g_assert (0 == strncmp (buf, "+3.14159", 8));
+
+  res = g_snprintf (buf, 128, "% f", G_PI);
+  g_assert_cmpint (res, ==, 9);
+  g_assert (0 == strncmp (buf, " 3.14159", 8));
+
+  res = g_snprintf (buf, 128, "%#.0f", G_PI);
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "3.");
+
+  res = g_snprintf (buf, 128, "%05.2f", G_PI);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "03.14");
+}
+
+static gboolean
+same_value (const gchar *actual, 
+            const gchar *expected)
+{
+  gdouble actual_value, expected_value;
+
+  actual_value = g_ascii_strtod (actual, NULL);
+  expected_value = g_ascii_strtod (expected, NULL);
+
+  return actual_value == expected_value;
+}
+
+static void
+test_e (void)
+{
+  gchar buf[128];
+  gint res;
+
+  /* %e, basic formatting */
+  /* for %e we can't expect to reproduce exact strings and lengths, since SUS
+   * only guarantees that the exponent shall always contain at least two 
+   * digits. On Windows, it seems to be at least three digits long.
+   * Therefore, we compare the results of parsing the expected result and the
+   * actual result.
+   */
+
+  res = g_snprintf (buf, 128, "%e", G_PI);
+  g_assert_cmpint (res, >=, 12);
+  g_assert (same_value (buf, "3.141593e+00"));
+
+  res = g_snprintf (buf, 128, "%.8e", G_PI);
+  g_assert_cmpint (res, >=, 14);
+  g_assert (same_value (buf, "3.14159265e+00"));
+
+  res = g_snprintf (buf, 128, "%.0e", G_PI);
+  g_assert_cmpint (res, >=, 5);
+  g_assert (same_value (buf, "3e+00"));
+
+  res = g_snprintf (buf, 128, "%.1e", 0.0);
+  g_assert_cmpint (res, >=, 7);
+  g_assert (same_value (buf, "0.0e+00"));
+
+  res = g_snprintf (buf, 128, "%.1e", 0.00001);
+  g_assert_cmpint (res, >=, 7);
+  g_assert (same_value (buf, "1.0e-05"));
+
+  res = g_snprintf (buf, 128, "%.1e", 10000.0);
+  g_assert_cmpint (res, >=, 7);
+  g_assert (same_value (buf, "1.0e+04"));
+
+  /* %e, flags */
+
+  res = g_snprintf (buf, 128, "%+e", G_PI);
+  g_assert_cmpint (res, >=, 13);
+  g_assert (same_value (buf, "+3.141593e+00"));
+
+  res = g_snprintf (buf, 128, "% e", G_PI);
+  g_assert_cmpint (res, >=, 13);
+  g_assert (same_value (buf, " 3.141593e+00"));
+
+  res = g_snprintf (buf, 128, "%#.0e", G_PI);
+  g_assert_cmpint (res, >=, 6);
+  g_assert (same_value (buf, "3.e+00"));
+
+  res = g_snprintf (buf, 128, "%09.2e", G_PI);
+  g_assert_cmpint (res, >=, 9);
+  g_assert (same_value (buf, "03.14e+00"));
+}
+
+static void
+test_c (void)
+{
+  gchar buf[128];
+  gint res;
+
+  res = g_snprintf (buf, 128, "%c", 'a');
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "a");
+}
+
+static void
+test_s (void)
+{
+  gchar buf[128];
+  gint res;
+
+  res = g_snprintf (buf, 128, "%.2s", "abc");
+  g_assert_cmpint (res, ==, 2);
+  g_assert_cmpstr (buf, ==, "ab");
+
+  res = g_snprintf (buf, 128, "%.6s", "abc");
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "abc");
+
+  res = g_snprintf (buf, 128, "%5s", "abc");
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  abc");
+
+  res = g_snprintf (buf, 128, "%-5s", "abc");
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "abc  ");
+
+  res = g_snprintf (buf, 128, "%5.2s", "abc");
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "   ab");
+
+  res = g_snprintf (buf, 128, "%*s", 5, "abc");
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "  abc");
+
+#if 0 /* HP-UX doesn't get this right */
+  res = g_snprintf (buf, 128, "%*s", -5, "abc");
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "abc  ");
+#endif
+
+  res = g_snprintf (buf, 128, "%*.*s", 5, 2, "abc");
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "   ab");
+}
+
+static void
+test_n (void)
+{
+  gchar buf[128];
+  gint res;
+  gint i;
+  glong l;
+
+  res = g_snprintf (buf, 128, "abc%n", &i);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "abc");
+  g_assert_cmpint (i, ==, 3);
+
+  res = g_snprintf (buf, 128, "abc%ln", &l);
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "abc");
+  g_assert_cmpint (l, ==, 3);
+}
+
+static void
+test_percent (void)
+{
+  gchar buf[128];
+  gint res;
+
+  res = g_snprintf (buf, 128, "%%");
+  g_assert_cmpint (res, ==, 1);
+  g_assert_cmpstr (buf, ==, "%");
+}
+
+static void
+test_positional_params (void)
+{
+  gchar buf[128];
+  gint res;
+
+  res = g_snprintf (buf, 128, "%2$c %1$c", 'b', 'a');
+  g_assert_cmpint (res, ==, 3);
+  g_assert_cmpstr (buf, ==, "a b");
+
+  res = g_snprintf (buf, 128, "%1$*2$.*3$s", "abc", 5, 2);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "   ab");
+
+  res = g_snprintf (buf, 128, "%1$s%1$s", "abc");
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "abcabc");
+}
+
+static void
+test_64bit (void)
+{
+  gchar buf[128];
+  gint res;
+
+  res = g_snprintf (buf, 128, "%" G_GINT64_FORMAT, (gint64)123456);
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "123456");
+
+  res = g_snprintf (buf, 128, "%" G_GINT64_FORMAT, (gint64)-123456);
+  g_assert_cmpint (res, ==, 7);
+  g_assert_cmpstr (buf, ==, "-123456");
+
+  res = g_snprintf (buf, 128, "%" G_GUINT64_FORMAT, (guint64)123456);
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "123456");
+
+  res = g_snprintf (buf, 128, "%" G_GINT64_MODIFIER "o", (gint64)123456);
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "361100");
+
+  res = g_snprintf (buf, 128, "%#" G_GINT64_MODIFIER "o", (gint64)123456);
+  g_assert_cmpint (res, ==, 7);
+  g_assert_cmpstr (buf, ==, "0361100");
+
+  res = g_snprintf (buf, 128, "%" G_GINT64_MODIFIER "x", (gint64)123456);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "1e240");
+
+  res = g_snprintf (buf, 128, "%#" G_GINT64_MODIFIER "x", (gint64)123456);
+  g_assert_cmpint (res, ==, 7);
+  g_assert_cmpstr (buf, ==, "0x1e240");
+
+  res = g_snprintf (buf, 128, "%" G_GINT64_MODIFIER "X", (gint64)123456);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "1E240");
+
+#ifdef G_OS_WIN32
+  /* On Win32, test that the "ll" modifier also works, for backward
+   * compatibility. One really should use the G_GINT64_MODIFIER (which
+   * on Win32 is the "I64" that the (msvcrt) C library's printf uses),
+   * but "ll" used to work with the "trio" g_printf implementation in
+   * GLib 2.2, so it's best if it continues to work.
+   */
+
+  res = g_snprintf (buf, 128, "%" "lli", (gint64)123456);
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "123456");
+
+  res = g_snprintf (buf, 128, "%" "lli", (gint64)-123456);
+  g_assert_cmpint (res, ==, 7);
+  g_assert_cmpstr (buf, ==, "-123456");
+
+  res = g_snprintf (buf, 128, "%" "llu", (guint64)123456);
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "123456");
+
+  res = g_snprintf (buf, 128, "%" "ll" "o", (gint64)123456);
+  g_assert_cmpint (res, ==, 6);
+  g_assert_cmpstr (buf, ==, "361100");
+
+  res = g_snprintf (buf, 128, "%#" "ll" "o", (gint64)123456);
+  g_assert_cmpint (res, ==, 7);
+  g_assert_cmpstr (buf, ==, "0361100");
+
+  res = g_snprintf (buf, 128, "%" "ll" "x", (gint64)123456);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "1e240");
+
+  res = g_snprintf (buf, 128, "%#" "ll" "x", (gint64)123456);
+  g_assert_cmpint (res, ==, 7);
+  g_assert_cmpstr (buf, ==, "0x1e240");
+
+  res = g_snprintf (buf, 128, "%" "ll" "X", (gint64)123456);
+  g_assert_cmpint (res, ==, 5);
+  g_assert_cmpstr (buf, ==, "1E240");
+#endif
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/printf/test-retval-and-trunc", test_retval_and_trunc);
+  g_test_add_func ("/printf/test-d", test_d);
+  g_test_add_func ("/printf/test-o", test_o);
+  g_test_add_func ("/printf/test-u", test_u);
+  g_test_add_func ("/printf/test-x", test_x);
+  g_test_add_func ("/printf/test-X", test_X);
+  g_test_add_func ("/printf/test-f", test_f);
+  g_test_add_func ("/printf/test-e", test_e);
+  g_test_add_func ("/printf/test-c", test_c);
+  g_test_add_func ("/printf/test-s", test_s);
+  g_test_add_func ("/printf/test-n", test_n);
+  g_test_add_func ("/printf/test-percent", test_percent);
+  g_test_add_func ("/printf/test-positional-params", test_positional_params);
+  g_test_add_func ("/printf/test-64bit", test_64bit);
+
+  return g_test_run();
+}

Added: trunk/glib/tests/rand.c
==============================================================================
--- (empty file)
+++ trunk/glib/tests/rand.c	Mon Sep  1 09:31:40 2008
@@ -0,0 +1,162 @@
+/* Unit tests for gstring
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work 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.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include "glib.h"
+
+/* Outputs tested against the reference implementation mt19937ar.c from
+   http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html */
+
+/* Tests for a simple seed, first number is the seed */
+const guint32 first_numbers[] = 
+{
+  0x7a7a7a7a,
+  0xfdcc2d54,
+  0x3a279ceb,
+  0xc4d39c33,
+  0xf31895cd,
+  0x46ca0afc,
+  0x3f5484ff,
+  0x54bc9557,
+  0xed2c24b1,
+  0x84062503,
+  0x8f6404b3,
+  0x599a94b3,
+  0xe46d03d5,
+  0x310beb78,
+  0x7bee5d08,
+  0x760d09be,
+  0x59b6e163,
+  0xbf6d16ec,
+  0xcca5fb54,
+  0x5de7259b,
+  0x1696330c,
+};
+
+/* array seed */
+const guint32 seed_array[] =
+{
+  0x6553375f,
+  0xd6b8d43b,
+  0xa1e7667f,
+  0x2b10117c
+};
+
+/* tests for the array seed */
+const guint32 array_outputs[] =
+{
+  0xc22b7dc3,
+  0xfdecb8ae,
+  0xb4af0738,
+  0x516bc6e1,
+  0x7e372e91,
+  0x2d38ff80,
+  0x6096494a,
+  0xd162d5a8,
+  0x3c0aaa0d,
+  0x10e736ae
+};
+
+static void
+test_rand (void)
+{
+  guint n;
+  guint ones;
+  double proportion;
+  GRand *rand;
+  GRand *copy;
+
+  rand = g_rand_new_with_seed (first_numbers[0]);
+
+  for (n = 1; n < G_N_ELEMENTS (first_numbers); n++)
+    g_assert (first_numbers[n] == g_rand_int (rand));
+
+  g_rand_set_seed (rand, 2);
+  g_rand_set_seed_array (rand, seed_array, G_N_ELEMENTS (seed_array));
+
+  for (n = 0; n < G_N_ELEMENTS (array_outputs); n++)
+    g_assert (array_outputs[n] == g_rand_int (rand));
+
+  copy = g_rand_copy (rand);
+  for (n = 0; n < 100; n++)
+    g_assert (g_rand_int (copy) == g_rand_int (rand));
+
+  for (n = 1; n < 100000; n++)
+    {
+      gint32 i;
+      gdouble d;
+      gboolean b;
+
+      i = g_rand_int_range (rand, 8,16);
+      g_assert (i >= 8 && i < 16);
+      
+      i = g_random_int_range (8,16);
+      g_assert (i >= 8 && i < 16);
+
+      d = g_rand_double (rand);
+      g_assert (d >= 0 && d < 1);
+
+      d = g_random_double ();
+      g_assert (d >= 0 && d < 1);
+
+      d = g_rand_double_range (rand, -8, 32);
+      g_assert (d >= -8 && d < 32);
+ 
+      d = g_random_double_range (-8, 32);
+      g_assert (d >= -8 && d < 32);
+ 
+      b = g_random_boolean ();
+      g_assert (b == TRUE || b  == FALSE);
+ 
+      b = g_rand_boolean (rand);
+      g_assert (b == TRUE || b  == FALSE);     
+    }
+
+  /* Statistical sanity check, count the number of ones
+   * when getting random numbers in range [0,3) and see
+   * that it must be semi-close to 0.25 with a VERY large
+   * probability */
+  ones = 0;
+  for (n = 1; n < 100000; n++)
+    {
+      if (g_random_int_range (0, 4) == 1)
+        ones ++;
+    }
+
+  proportion = (double)ones / (double)100000;
+  /* 0.025 is overkill, but should suffice to test for some unreasonability */
+  g_assert (ABS (proportion - 0.25) < 0.025);
+
+  g_rand_free (rand);
+  g_rand_free (copy);
+
+  return 0;
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/rand/test-rand", test_rand);
+
+  return g_test_run();
+}

Added: trunk/glib/tests/string.c
==============================================================================
--- (empty file)
+++ trunk/glib/tests/string.c	Mon Sep  1 09:31:40 2008
@@ -0,0 +1,394 @@
+/* Unit tests for gstring
+ * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This work is provided "as is"; redistribution and modification
+ * in whole or in part, in any medium, physical or electronic is
+ * permitted without restriction.
+ *
+ * This work 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.
+ *
+ * In no event shall the authors or contributors be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential
+ * damages (including, but not limited to, procurement of substitute
+ * goods or services; loss of use, data, or profits; or business
+ * interruption) however caused and on any theory of liability, whether
+ * in contract, strict liability, or tort (including negligence or
+ * otherwise) arising in any way out of the use of this software, even
+ * if advised of the possibility of such damage.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "glib.h"
+
+
+static void
+test_string_chunks (void)
+{
+  GStringChunk *string_chunk;
+  gchar *tmp_string, *tmp_string_2;
+  gint i;
+
+  string_chunk = g_string_chunk_new (1024);
+
+  for (i = 0; i < 100000; i ++)
+    {
+      tmp_string = g_string_chunk_insert (string_chunk, "hi pete");
+      g_assert_cmpstr ("hi pete", ==, tmp_string);
+    }
+
+  tmp_string_2 = g_string_chunk_insert_const (string_chunk, tmp_string);
+  g_assert (tmp_string_2 != tmp_string);
+  g_assert_cmpstr (tmp_string_2, ==, tmp_string);
+
+  tmp_string = g_string_chunk_insert_const (string_chunk, tmp_string);
+  g_assert_cmpstr (tmp_string_2, ==, tmp_string);
+
+  g_string_chunk_free (string_chunk);
+}
+
+static void
+test_string_new (void)
+{
+  GString *string1, *string2;
+
+  string1 = g_string_new ("hi pete!");
+  string2 = g_string_new (NULL);
+
+  g_assert (string1 != NULL);
+  g_assert (string2 != NULL);
+  g_assert (strlen (string1->str) == string1->len);
+  g_assert (strlen (string2->str) == string2->len);
+  g_assert (string2->len == 0);
+  g_assert_cmpstr ("hi pete!", ==, string1->str);
+  g_assert_cmpstr ("", ==, string2->str);
+
+  g_string_free (string1, TRUE);
+  g_string_free (string2, TRUE);
+}
+
+static void
+test_string_printf (void)
+{
+  GString *string;
+
+  string = g_string_new (NULL);
+
+#ifndef G_OS_WIN32
+  /* MSVC and mingw32 use the same run-time C library, which doesn't like
+     the %10000.10000f format... */
+  g_string_printf (string, "%s|%0100d|%s|%0*d|%*.*f|%10000.10000f",
+		   "this pete guy sure is a wuss, like he's the number ",
+		   1,
+		   " wuss.  everyone agrees.\n",
+		   10, 666, 15, 15, 666.666666666, 666.666666666);
+#else
+  g_string_printf (string, "%s|%0100d|%s|%0*d|%*.*f|%100.100f",
+		   "this pete guy sure is a wuss, like he's the number ",
+		   1,
+		   " wuss.  everyone agrees.\n",
+		   10, 666, 15, 15, 666.666666666, 666.666666666);
+#endif
+  
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_assign (void)
+{
+  GString *string;
+
+  string = g_string_new (NULL);
+  g_string_assign (string, "boring text");
+  g_assert_cmpstr (string->str, ==, "boring text");
+  g_string_free (string, TRUE);
+
+  /* assign with string overlap */
+  string = g_string_new ("textbeforetextafter");
+  g_string_assign (string, string->str + 10);
+  g_assert_cmpstr (string->str, ==, "textafter");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("boring text");
+  g_string_assign (string, string->str);
+  g_assert_cmpstr (string->str, ==, "boring text");
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_append_c (void)
+{
+  GString *string;
+  gint i;
+
+  string = g_string_new ("hi pete!");
+
+  for (i = 0; i < 10000; i++)
+    g_string_append_c (string, 'a'+(i%26));
+
+  g_assert((strlen("hi pete!") + 10000) == string->len);
+  g_assert((strlen("hi pete!") + 10000) == strlen(string->str));
+
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_append (void)
+{
+  GString *string;
+
+  /* append */
+  string = g_string_new ("firsthalf");
+  g_string_append (string, "lasthalf");
+  g_assert_cmpstr (string->str, ==, "firsthalflasthalf");
+  g_string_free (string, TRUE);
+
+  /* append_len */
+  string = g_string_new ("firsthalf");
+  g_string_append_len (string, "lasthalfjunkjunk", strlen ("lasthalf"));
+  g_assert_cmpstr (string->str, ==, "firsthalflasthalf");
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_prepend_c (void)
+{
+  GString *string;
+  gint i;
+
+  string = g_string_new ("hi pete!");
+
+  for (i = 0; i < 10000; i++)
+    g_string_prepend_c (string, 'a'+(i%26));
+
+  g_assert((strlen("hi pete!") + 10000) == string->len);
+  g_assert((strlen("hi pete!") + 10000) == strlen(string->str));
+
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_prepend (void)
+{
+  GString *string;
+
+  /* prepend */
+  string = g_string_new ("lasthalf");
+  g_string_prepend (string, "firsthalf");
+  g_assert_cmpstr (string->str, ==, "firsthalflasthalf");
+  g_string_free (string, TRUE);
+
+  /* prepend_len */
+  string = g_string_new ("lasthalf");
+  g_string_prepend_len (string, "firsthalfjunkjunk", strlen ("firsthalf"));
+  g_assert_cmpstr (string->str, ==, "firsthalflasthalf");
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_insert (void)
+{
+  GString *string;
+
+  /* insert */
+  string = g_string_new ("firstlast");
+  g_string_insert (string, 5, "middle");
+  g_assert_cmpstr (string->str, ==, "firstmiddlelast");
+  g_string_free (string, TRUE);
+
+  /* insert with pos == end of the string */
+  string = g_string_new ("firstmiddle");
+  g_string_insert (string, strlen ("firstmiddle"), "last");
+  g_assert_cmpstr (string->str, ==, "firstmiddlelast");
+  g_string_free (string, TRUE);
+  
+  /* insert_len */
+  string = g_string_new ("firstlast");
+  g_string_insert_len (string, 5, "middlejunkjunk", strlen ("middle"));
+  g_assert_cmpstr (string->str, ==, "firstmiddlelast");
+  g_string_free (string, TRUE);
+
+  /* insert_len with magic -1 pos for append */
+  string = g_string_new ("first");
+  g_string_insert_len (string, -1, "lastjunkjunk", strlen ("last"));
+  g_assert_cmpstr (string->str, ==, "firstlast");
+  g_string_free (string, TRUE);
+  
+  /* insert_len with magic -1 len for strlen-the-string */
+  string = g_string_new ("first");
+  g_string_insert_len (string, 5, "last", -1);
+  g_assert_cmpstr (string->str, ==, "firstlast");
+  g_string_free (string, TRUE);
+
+  /* insert_len with string overlap */
+  string = g_string_new ("textbeforetextafter");
+  g_string_insert_len (string, 10, string->str + 8, 5);
+  g_assert_cmpstr (string->str, ==, "textbeforeretextextafter");
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_insert_unichar (void)
+{
+  GString *string;
+
+  /* insert_unichar with insertion in middle */
+  string = g_string_new ("firsthalf");
+  g_string_insert_unichar (string, 5, 0x0041);
+  g_assert_cmpstr (string->str, ==, "first\x41half");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("firsthalf");
+  g_string_insert_unichar (string, 5, 0x0298);
+  g_assert_cmpstr (string->str, ==, "first\xCA\x98half");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("firsthalf");
+  g_string_insert_unichar (string, 5, 0xFFFD);
+  g_assert_cmpstr (string->str, ==, "first\xEF\xBF\xBDhalf");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("firsthalf");
+  g_string_insert_unichar (string, 5, 0x1D100);
+  g_assert_cmpstr (string->str, ==, "first\xF0\x9D\x84\x80half");
+  g_string_free (string, TRUE);
+
+  /* insert_unichar with insertion at end */
+  string = g_string_new ("start");
+  g_string_insert_unichar (string, -1, 0x0041);
+  g_assert_cmpstr (string->str, ==, "start\x41");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("start");
+  g_string_insert_unichar (string, -1, 0x0298);
+  g_assert_cmpstr (string->str, ==, "start\xCA\x98");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("start");
+  g_string_insert_unichar (string, -1, 0xFFFD);
+  g_assert_cmpstr (string->str, ==, "start\xEF\xBF\xBD");
+  g_string_free (string, TRUE);
+
+  string = g_string_new ("start");
+  g_string_insert_unichar (string, -1, 0x1D100);
+  g_assert_cmpstr (string->str, ==, "start\xF0\x9D\x84\x80");
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_equal (void)
+{
+  GString *string1, *string2;
+
+  string1 = g_string_new ("test");
+  string2 = g_string_new ("te");
+  g_assert (!g_string_equal(string1, string2));
+  g_string_append (string2, "st");
+  g_assert (g_string_equal(string1, string2));
+  g_string_free (string1, TRUE);
+  g_string_free (string2, TRUE);
+}
+
+static void
+test_string_truncate (void)
+{
+  GString *string;
+
+  string = g_string_new ("testing");
+
+  g_string_truncate (string, 1000);
+  g_assert (string->len == strlen("testing"));
+  g_assert_cmpstr (string->str, ==, "testing");
+
+  g_string_truncate (string, 4);
+  g_assert (string->len == 4);
+  g_assert_cmpstr (string->str, ==, "test");
+
+  g_string_truncate (string, 0);
+  g_assert (string->len == 0);
+  g_assert_cmpstr (string->str, ==, "");
+
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_overwrite (void)
+{
+  GString *string;
+
+  /* overwriting functions */
+  string = g_string_new ("testing");
+
+  g_string_overwrite (string, 4, " and expand");
+  g_assert (15 == string->len);
+  g_assert ('\0' == string->str[15]);
+  g_assert (g_str_equal ("test and expand", string->str));
+
+  g_string_overwrite (string, 5, "NOT-");
+  g_assert (15 == string->len);
+  g_assert ('\0' == string->str[15]);
+  g_assert (g_str_equal ("test NOT-expand", string->str));
+
+  g_string_overwrite_len (string, 9, "blablabla", 6);
+  g_assert (15 == string->len);
+  g_assert ('\0' == string->str[15]);
+  g_assert (g_str_equal ("test NOT-blabla", string->str));
+
+  g_string_free (string, TRUE);
+}
+
+static void
+test_string_nul_handling (void)
+{
+  GString *string1, *string2;
+
+  /* Check handling of embedded ASCII 0 (NUL) characters in GString. */
+  string1 = g_string_new ("fiddle");
+  string2 = g_string_new ("fiddle");
+  g_assert (g_string_equal (string1, string2));
+  g_string_append_c (string1, '\0');
+  g_assert (!g_string_equal (string1, string2));
+  g_string_append_c (string2, '\0');
+  g_assert (g_string_equal (string1, string2));
+  g_string_append_c (string1, 'x');
+  g_string_append_c (string2, 'y');
+  g_assert (!g_string_equal (string1, string2));
+  g_assert (string1->len == 8);
+  g_string_append (string1, "yzzy");
+  g_assert (string1->len == 12);
+  g_assert (memcmp (string1->str, "fiddle\0xyzzy", 13) == 0);
+  g_string_insert (string1, 1, "QED");
+  g_assert (memcmp (string1->str, "fQEDiddle\0xyzzy", 16) == 0);
+  g_string_printf (string1, "fiddle%cxyzzy", '\0');
+  g_assert (string1->len == 12);
+  g_assert (memcmp (string1->str, "fiddle\0xyzzy", 13) == 0);
+
+  g_string_free (string1, TRUE);
+  g_string_free (string2, TRUE);
+}
+
+int
+main (int   argc,
+      char *argv[])
+{
+  g_test_init (&argc, &argv, NULL);
+
+  g_test_add_func ("/string/test-string-chunks", test_string_chunks);
+  g_test_add_func ("/string/test-string-new", test_string_new);
+  g_test_add_func ("/string/test-string-printf", test_string_printf);
+  g_test_add_func ("/string/test-string-assign", test_string_assign);
+  g_test_add_func ("/string/test-string-append-c", test_string_append_c);
+  g_test_add_func ("/string/test-string-append", test_string_append);
+  g_test_add_func ("/string/test-string-prepend-c", test_string_prepend_c);
+  g_test_add_func ("/string/test-string-prepend", test_string_prepend);
+  g_test_add_func ("/string/test-string-insert", test_string_insert);
+  g_test_add_func ("/string/test-string-insert-unichar", test_string_insert_unichar);
+  g_test_add_func ("/string/test-string-equal", test_string_equal);
+  g_test_add_func ("/string/test-string-truncate", test_string_truncate);
+  g_test_add_func ("/string/test-string-overwrite", test_string_overwrite);
+  g_test_add_func ("/string/test-string-nul-handling", test_string_nul_handling);
+
+  return g_test_run();
+}

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Mon Sep  1 09:31:40 2008
@@ -119,11 +119,9 @@
 	node-test				\
 	onceinit				\
 	patterntest				\
-	printf-test				\
 	queue-test				\
 	asyncqueue-test				\
 	qsort-test				\
-	rand-test				\
 	relation-test				\
 	sequence-test				\
 	shell-test				\
@@ -134,7 +132,6 @@
 	slice-threadinit			\
 	spawn-test				\
 	$(spawn_test_win32_gui)			\
-	string-test				\
 	thread-test				\
 	threadpool-test				\
 	tree-test				\
@@ -186,11 +183,9 @@
 module_test_LDFLAGS = $(G_MODULE_LDFLAGS)
 node_test_LDADD = $(progs_ldadd)
 onceinit_LDADD = $(thread_ldadd)
-printf_test_LDADD = $(progs_ldadd)
 queue_test_LDADD = $(progs_ldadd)
 asyncqueue_test_LDADD = $(thread_ldadd)
 qsort_test_LDADD = $(progs_ldadd)
-rand_test_LDADD = $(progs_ldadd)
 relation_test_LDADD = $(progs_ldadd)
 sequence_test_LDADD = $(progs_ldadd)
 shell_test_LDADD = $(progs_ldadd)
@@ -204,7 +199,6 @@
 slice_threadinit_SOURCES = slice-threadinit.c
 slice_threadinit_LDADD = $(thread_ldadd)
 spawn_test_LDADD = $(progs_ldadd)
-string_test_LDADD = $(progs_ldadd)
 thread_test_LDADD = $(thread_ldadd)
 threadpool_test_LDADD = $(thread_ldadd)
 tree_test_LDADD = $(progs_ldadd)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]