mirror of git://sourceware.org/git/glibc.git
Convert tst-iconv5 to use test-skeleton.
This commit is contained in:
parent
d19df6ac5a
commit
fd1f2f1c3d
|
@ -1,5 +1,13 @@
|
||||||
2015-02-25 Roland McGrath <roland@hack.frob.com>
|
2015-02-25 Roland McGrath <roland@hack.frob.com>
|
||||||
|
|
||||||
|
* iconv/tst-iconv5.c (testcode, number): Make variables static const.
|
||||||
|
(convert): Make function static.
|
||||||
|
(test_unalign): Likewise. Add const to argument pointee types.
|
||||||
|
(main): Replace with static function do_test.
|
||||||
|
Print "Succeeded." only if RET is zero.
|
||||||
|
(TEST_FUNCTION): New macro.
|
||||||
|
Include test-skeleton.c.
|
||||||
|
|
||||||
* iconv/gconv_conf.c (__gconv_get_path): Don't crash if __getcwd
|
* iconv/gconv_conf.c (__gconv_get_path): Don't crash if __getcwd
|
||||||
returns a null pointer.
|
returns a null pointer.
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct convcode
|
||||||
};
|
};
|
||||||
|
|
||||||
/* test builtin transformation */
|
/* test builtin transformation */
|
||||||
struct convcode testcode[] = {
|
static const struct convcode testcode[] = {
|
||||||
{"ASCII", "ASCII"},
|
{"ASCII", "ASCII"},
|
||||||
{"UTF-8", "ASCII"},
|
{"UTF-8", "ASCII"},
|
||||||
{"UCS-2BE", "ASCII"},
|
{"UCS-2BE", "ASCII"},
|
||||||
|
@ -47,9 +47,9 @@ struct convcode testcode[] = {
|
||||||
{"UCS-4LE", "ASCII"},
|
{"UCS-4LE", "ASCII"},
|
||||||
};
|
};
|
||||||
|
|
||||||
int number = (int) sizeof (testcode) / sizeof (struct convcode);
|
static const int number = (int) sizeof (testcode) / sizeof (struct convcode);
|
||||||
|
|
||||||
int
|
static int
|
||||||
convert (const char *tocode, const char *fromcode, char *inbufp,
|
convert (const char *tocode, const char *fromcode, char *inbufp,
|
||||||
size_t inbytesleft, char *outbufp, size_t outbytesleft)
|
size_t inbytesleft, char *outbufp, size_t outbytesleft)
|
||||||
{
|
{
|
||||||
|
@ -88,8 +88,8 @@ convert (const char *tocode, const char *fromcode, char *inbufp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
static int
|
||||||
test_unalign (struct convcode *codes, char *str, int len)
|
test_unalign (const struct convcode *codes, const char *str, int len)
|
||||||
{
|
{
|
||||||
struct unalign *inbufp, *outbufp;
|
struct unalign *inbufp, *outbufp;
|
||||||
char *inbuf, *outbuf;
|
char *inbuf, *outbuf;
|
||||||
|
@ -137,8 +137,8 @@ test_unalign (struct convcode *codes, char *str, int len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
main (int argc, char *argv[])
|
do_test (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -151,7 +151,11 @@ main (int argc, char *argv[])
|
||||||
printf ("iconv: %s <-> %s: ok\n",
|
printf ("iconv: %s <-> %s: ok\n",
|
||||||
testcode[i].fromcode, testcode[i].tocode);
|
testcode[i].fromcode, testcode[i].tocode);
|
||||||
}
|
}
|
||||||
|
if (ret == 0)
|
||||||
printf ("Succeeded.\n");
|
printf ("Succeeded.\n");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
#include "../test-skeleton.c"
|
||||||
|
|
Loading…
Reference in New Issue