diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/iconvdata/tst-iconv7.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.gz glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.tar.xz glibc-5046dbb4a7eba5eccfd258f92f4735c9ffc8d069.zip |
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/iconvdata/tst-iconv7.c')
-rw-r--r-- | REORG.TODO/iconvdata/tst-iconv7.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/REORG.TODO/iconvdata/tst-iconv7.c b/REORG.TODO/iconvdata/tst-iconv7.c new file mode 100644 index 0000000000..a01e3d8425 --- /dev/null +++ b/REORG.TODO/iconvdata/tst-iconv7.c @@ -0,0 +1,61 @@ +#include <iconv.h> +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +static int +do_test (void) +{ + setlocale (LC_ALL, "de_DE.UTF-8"); + + iconv_t cd = iconv_open ("ISO-2022-JP//TRANSLIT", ""); + if (cd == (iconv_t) -1) + { + puts ("iconv_open failed"); + return 1; + } + + char instr1[] = "\xc2\xa3\xe2\x82\xac\n"; + const char expstr1[] = "\033$B!r\033(BEUR\n"; + char outstr[32]; + size_t inlen = sizeof (instr1); + size_t outlen = sizeof (outstr); + char *inptr = instr1; + char *outptr = outstr; + size_t r = iconv (cd, &inptr, &inlen, &outptr, &outlen); + if (r != 1 + || inlen != 0 + || outlen != sizeof (outstr) - sizeof (expstr1) + || memcmp (outstr, expstr1, sizeof (expstr1)) != 0) + { + puts ("wrong first conversion"); + return 1; + } + + char instr2[] = "\xe3\x88\xb1\n"; + const char expstr2[] = "(\033$B3t\033(B)\n"; + inlen = sizeof (instr2); + outlen = sizeof (outstr); + inptr = instr2; + outptr = outstr; + r = iconv (cd, &inptr, &inlen, &outptr, &outlen); + if (r != 1 + || inlen != 0 + || outlen != sizeof (outstr) - sizeof (expstr2) + || memcmp (outstr, expstr2, sizeof (expstr2)) != 0) + { + puts ("wrong second conversion"); + return 1; + } + + if (iconv_close (cd) != 0) + { + puts ("iconv_close failed"); + return 1; + } + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" |