X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Funistdio%2Ftest-ulc-printf1.h;h=c05966dd4e800c4de07474ef46f518420086ba88;hb=b8c5e24996c9626f03890cd986fc1fb7b17fa610;hp=efcc48f6779703fd9f2aaa95fdcd9b14bb14411c;hpb=2625ca90abe3246f6d3240d59d32f1843afc9651;p=gnulib.git diff --git a/tests/unistdio/test-ulc-printf1.h b/tests/unistdio/test-ulc-printf1.h index efcc48f67..c05966dd4 100644 --- a/tests/unistdio/test-ulc-printf1.h +++ b/tests/unistdio/test-ulc-printf1.h @@ -1,10 +1,10 @@ /* Test of ulc_v[a]s[n]printf() functions. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,8 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* Written by Bruno Haible , 2007. */ @@ -60,28 +59,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { char *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -92,28 +91,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { char *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -124,28 +123,28 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { char *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* Width. */ char *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); } { /* FLAG_LEFT. */ char *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "Hello 33") == 0); free (result); } { /* FLAG_ZERO: no effect. */ char *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " Hello 33") == 0); free (result); @@ -194,9 +193,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%a %d", 3.1416015625, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.922p+1 33") == 0 - || strcmp (result, "0x3.244p+0 33") == 0 - || strcmp (result, "0x6.488p-1 33") == 0 - || strcmp (result, "0xc.91p-2 33") == 0); + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); free (result); } @@ -205,9 +204,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%10a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 - || strcmp (result, " 0x3.8p-1 33") == 0 - || strcmp (result, " 0x7p-2 33") == 0 - || strcmp (result, " 0xep-3 33") == 0); + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); free (result); } @@ -216,9 +215,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 - || strcmp (result, "0x3.8000000000p-1 33") == 0 - || strcmp (result, "0x7.0000000000p-2 33") == 0 - || strcmp (result, "0xe.0000000000p-3 33") == 0); + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); free (result); } @@ -227,9 +226,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 - || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 - || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 - || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); free (result); } @@ -238,9 +237,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.922p+1 33") == 0 - || strcmp (result, "0x3.244p+0 33") == 0 - || strcmp (result, "0x6.488p-1 33") == 0 - || strcmp (result, "0xc.91p-2 33") == 0); + || strcmp (result, "0x3.244p+0 33") == 0 + || strcmp (result, "0x6.488p-1 33") == 0 + || strcmp (result, "0xc.91p-2 33") == 0); free (result); } @@ -249,9 +248,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%10La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 0x1.cp+0 33") == 0 - || strcmp (result, " 0x3.8p-1 33") == 0 - || strcmp (result, " 0x7p-2 33") == 0 - || strcmp (result, " 0xep-3 33") == 0); + || strcmp (result, " 0x3.8p-1 33") == 0 + || strcmp (result, " 0x7p-2 33") == 0 + || strcmp (result, " 0xep-3 33") == 0); free (result); } @@ -260,9 +259,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c000000000p+0 33") == 0 - || strcmp (result, "0x3.8000000000p-1 33") == 0 - || strcmp (result, "0x7.0000000000p-2 33") == 0 - || strcmp (result, "0xe.0000000000p-3 33") == 0); + || strcmp (result, "0x3.8000000000p-1 33") == 0 + || strcmp (result, "0x7.0000000000p-2 33") == 0 + || strcmp (result, "0xe.0000000000p-3 33") == 0); free (result); } @@ -271,9 +270,9 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "0x1.c0000000000000000000000000000000000000000000000000p+0 33") == 0 - || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 - || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 - || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); + || strcmp (result, "0x3.80000000000000000000000000000000000000000000000000p-1 33") == 0 + || strcmp (result, "0x7.00000000000000000000000000000000000000000000000000p-2 33") == 0 + || strcmp (result, "0xe.00000000000000000000000000000000000000000000000000p-3 33") == 0); free (result); } @@ -368,7 +367,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1.275000e+01 33") == 0 - || strcmp (result, "1.275000e+001 33") == 0); + || strcmp (result, "1.275000e+001 33") == 0); free (result); } @@ -377,7 +376,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, " 1.750000e+00 33") == 0 - || strcmp (result, " 1.750000e+000 33") == 0); + || strcmp (result, " 1.750000e+000 33") == 0); free (result); } @@ -386,7 +385,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.e %d", 1234.0, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1e+03 33") == 0 - || strcmp (result, "1e+003 33") == 0); + || strcmp (result, "1e+003 33") == 0); free (result); } @@ -437,7 +436,7 @@ test_xfunction (char * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.g %d", 1234.0, 33, 44, 55); ASSERT (result != NULL); ASSERT (strcmp (result, "1e+03 33") == 0 - || strcmp (result, "1e+003 33") == 0); + || strcmp (result, "1e+003 33") == 0); free (result); }