Change so that it works on platforms where isalpha is a macro only,
authorDarin Adler <darin@src.gnome.org>
Mon, 17 Sep 2001 15:27:04 +0000 (15:27 +0000)
committerDarin Adler <darin@src.gnome.org>
Mon, 17 Sep 2001 15:27:04 +0000 (15:27 +0000)
* tests/strfunc-test.c: (main): Change so that it works
on platforms where isalpha is a macro only, without the
corresponding function that the C standard requires.
Also eliminate the multiple lists of ctype functions.

* tests/.cvsignore: Ignore the new test.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
tests/.cvsignore
tests/strfunc-test.c

index 766bb99..517ae6f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 766bb99..517ae6f 100644 (file)
@@ -1,3 +1,12 @@
+2001-09-17  Darin Adler  <darin@bentspoon.com>
+
+       * tests/strfunc-test.c: (main): Change so that it works
+       on platforms where isalpha is a macro only, without the
+       corresponding function that the C standard requires.
+       Also eliminate the multiple lists of ctype functions.
+
+       * tests/.cvsignore: Ignore the new test.
+
 2001-09-17  Tor Lillqvist  <tml@iki.fi>
 
        * configure.in: Add variable for LT_CURRENT minus LT_AGE (the
index 41b92ac..220aedc 100644 (file)
@@ -37,6 +37,7 @@ strfunc-test
 string-test
 thread-test
 threadpool-test
+timeloop-closure
 tree-test
 type-test
 unicode-encoding
index fa3089a..5e361b9 100644 (file)
@@ -91,73 +91,35 @@ str_check (gchar *str,
   return ok;
 }
 
-static gboolean
-test_isalnum (gchar c)
-{
-  return g_ascii_isalnum (c);
-}
-
-static gboolean
-test_isalpha (gchar c)
-{
-  return g_ascii_isalpha (c);
-}
-
-static gboolean
-test_iscntrl (gchar c)
-{
-  return g_ascii_iscntrl (c);
-}
-
-static gboolean
-test_isdigit (gchar c)
-{
-  return g_ascii_isdigit (c);
-}
-
-static gboolean
-test_isgraph (gchar c)
-{
-  return g_ascii_isgraph (c);
-}
-
-static gboolean
-test_islower (gchar c)
-{
-  return g_ascii_islower (c);
-}
-
-static gboolean
-test_isprint (gchar c)
-{
-  return g_ascii_isprint (c);
-}
-
-static gboolean
-test_ispunct (gchar c)
-{
-  return g_ascii_ispunct (c);
-}
-
-static gboolean
-test_isspace (gchar c)
-{
-  return g_ascii_isspace (c);
-}
-
-static gboolean
-test_isupper (gchar c)
-{
-  return g_ascii_isupper (c);
-}
-
-static gboolean
-test_isxdigit (gchar c)
-{
-  return g_ascii_isxdigit (c);
-}
+#define FOR_ALL_CTYPE(macro)   \
+       macro(isalnum)          \
+       macro(isalpha)          \
+       macro(iscntrl)          \
+       macro(isdigit)          \
+       macro(isgraph)          \
+       macro(islower)          \
+       macro(isprint)          \
+       macro(ispunct)          \
+       macro(isspace)          \
+       macro(isupper)          \
+       macro(isxdigit)
+
+#define DEFINE_CALL_CTYPE(function)            \
+       static int                              \
+       call_##function (int c)                 \
+       {                                       \
+               return function (c);            \
+       }
 
+#define DEFINE_CALL_G_ASCII_CTYPE(function)    \
+       static gboolean                         \
+       call_g_ascii_##function (gchar c)       \
+       {                                       \
+               return g_ascii_##function (c);  \
+       }
 
+FOR_ALL_CTYPE (DEFINE_CALL_CTYPE)
+FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE)
 
 static void
 test_is_function (const char *name,
@@ -335,19 +297,9 @@ main (int   argc,
   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL));
   TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL));
 
-  #define TEST_IS(name) test_is_function (#name, test_##name, name, g_unichar_##name)
-
-  TEST_IS (isalnum);
-  TEST_IS (isalpha);
-  TEST_IS (iscntrl);
-  TEST_IS (isdigit);
-  TEST_IS (isgraph);
-  TEST_IS (islower);
-  TEST_IS (isprint);
-  TEST_IS (ispunct);
-  TEST_IS (isspace);
-  TEST_IS (isupper);
-  TEST_IS (isxdigit);
+  #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name);
+
+  FOR_ALL_CTYPE(TEST_IS)
 
   #undef TEST_IS