X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Ftsticonv.c;h=6f230c189b23b19f4f568880ba1c0a20694ac356;hb=48fdd95e1a026cfcc20ddd2329f0bda940f936e2;hp=a3fbda1eefe70f93b4f973937e6d0c6781fb16d3;hpb=273ad9b2ed17eaf4daa43e321ad4b96be2b92518;p=yaz-moved-to-github.git diff --git a/test/tsticonv.c b/test/tsticonv.c index a3fbda1..6f230c1 100644 --- a/test/tsticonv.c +++ b/test/tsticonv.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: tsticonv.c,v 1.6 2005-02-01 21:07:19 adam Exp $ + * $Id: tsticonv.c,v 1.9 2005-05-08 07:35:23 adam Exp $ */ #if HAVE_CONFIG_H @@ -52,8 +52,11 @@ static int compare_buffers(char *msg, int no, /* some test strings in ISO-8859-1 format */ static const char *iso_8859_1_a[] = { "ax" , - "\330", + "\xd8", "eneb\346r", + "\xe5" "\xd8", + "\xe5" "\xd8" "b", + "\xe5" "\xe5", 0 }; /* same test strings in MARC-8 format */ @@ -61,6 +64,9 @@ static const char *marc8_a[] = { "ax", "\xa2", /* latin capital letter o with stroke */ "eneb\xb5r", /* latin small letter ae */ + "\xea" "a\xa2", + "\xea" "a\xa2" "b", + "\xea" "a" "\xea" "a", 0 }; @@ -136,7 +142,8 @@ static void tst_marc8_to_ucs4b() }, { "\x61\xC2", /* a, phonorecord mark */ 8, "\x00\x00\x00\x61" "\x00\x00\x21\x17" - }, { + }, + { /* bug #258 */ "el" "\xe8" "am\xe8" "an", /* elaman where a is a" */ 32, "\x00\x00\x00" "e" @@ -147,7 +154,12 @@ static void tst_marc8_to_ucs4b() "\x00\x00\x00" "a" "\x00\x00\x03\x08" "\x00\x00\x00" "n" - }, { + }, + { /* bug #260 */ + "\xe5\xe8\x41", + 12, "\x00\x00\x00\x41" "\x00\x00\x03\x04" "\x00\x00\x03\x08" + }, + { 0, 0, 0 } }; @@ -160,7 +172,7 @@ static void tst_marc8_to_ucs4b() printf ("tsticonv 20 yaz_iconv_open failed\n"); exit(20); } - for (i = 6; ar[i].len; i++) + for (i = 0; ar[i].len; i++) { size_t r; size_t expect_len = ar[i].len; @@ -259,7 +271,7 @@ static void dconvert(int mandatory, const char *tmpcode) { if (!mandatory) return; - printf ("tsticonv code=%s 1\n", tmpcode); + printf ("tsticonv code=%s i=%d 1\n", tmpcode, i); exit(1); } r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); @@ -267,7 +279,7 @@ static void dconvert(int mandatory, const char *tmpcode) { int e = yaz_iconv_error(cd); - printf ("tsticonv code=%s 2 e=%d\n", tmpcode, e); + printf ("tsticonv code=%s i=%d 2 e=%d\n", tmpcode, i, e); exit(2); } yaz_iconv_close(cd); @@ -277,7 +289,7 @@ static void dconvert(int mandatory, const char *tmpcode) { if (!mandatory) return; - printf ("tsticonv code=%s 3\n", tmpcode); + printf ("tsticonv code=%s i=%d 3\n", tmpcode, i); exit(3); } inbuf = outbuf0; @@ -289,7 +301,7 @@ static void dconvert(int mandatory, const char *tmpcode) if (r == (size_t)(-1)) { int e = yaz_iconv_error(cd); - printf ("tsticonv code=%s 4 e=%d\n", tmpcode, e); + printf ("tsticonv code=%s i=%d 4 e=%d\n", tmpcode, i, e); exit(4); } compare_buffers("dconvert", i, @@ -309,5 +321,5 @@ int main (int argc, char **argv) tst_marc8_to_iso_8859_1(); tst_marc8_to_ucs4b(); tst_ucs4b_to_utf8(); - exit (0); + exit(0); }