X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Funistdio%2Ftest-u8-printf1.h;h=e8eecd8ddbe93a1e85ca72be57b11c61b5312ee8;hb=b8c5e24996c9626f03890cd986fc1fb7b17fa610;hp=95154ff522c7b6c7494016fed8d42da91ef1718f;hpb=2625ca90abe3246f6d3240d59d32f1843afc9651;p=gnulib.git diff --git a/tests/unistdio/test-u8-printf1.h b/tests/unistdio/test-u8-printf1.h index 95154ff52..e8eecd8dd 100644 --- a/tests/unistdio/test-u8-printf1.h +++ b/tests/unistdio/test-u8-printf1.h @@ -1,10 +1,10 @@ /* Test of u8_v[a]s[n]printf() function. - 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. */ @@ -64,7 +63,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint8_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -72,7 +71,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -80,7 +79,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -88,7 +87,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -100,7 +99,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint8_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -108,7 +107,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -116,7 +115,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -124,7 +123,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -136,7 +135,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint8_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -144,7 +143,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -152,7 +151,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -160,7 +159,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Hello 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -218,9 +217,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xc.91p-2 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -233,9 +232,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = " 0xep-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -248,9 +247,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.0000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -263,9 +262,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.00000000000000000000000000000000000000000000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -278,9 +277,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xc.91p-2 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -293,9 +292,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = " 0xep-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -308,9 +307,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.0000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -323,9 +322,9 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected4[] = "0xe.00000000000000000000000000000000000000000000000000p-3 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0 - || u8_strcmp (result, expected3) == 0 - || u8_strcmp (result, expected4) == 0); + || u8_strcmp (result, expected2) == 0 + || u8_strcmp (result, expected3) == 0 + || u8_strcmp (result, expected4) == 0); free (result); } @@ -432,7 +431,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1.275000e+001 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -443,7 +442,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = " 1.750000e+000 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -454,7 +453,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1e+003 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -512,7 +511,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t expected2[] = "1e+003 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected1) == 0 - || u8_strcmp (result, expected2) == 0); + || u8_strcmp (result, expected2) == 0); free (result); } @@ -583,7 +582,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint8_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -591,7 +590,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -599,7 +598,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -607,7 +606,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -618,12 +617,12 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) { static const uint16_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint8_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -631,7 +630,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -639,7 +638,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -647,7 +646,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -658,12 +657,12 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) { static const uint32_t unicode_string[] = /* Rafał Maszkowski */ { - 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', - 's', 'k', 'i', 0 + 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', 'k', 'o', 'w', + 's', 'k', 'i', 0 }; { uint8_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -671,7 +670,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* Width. */ uint8_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -679,7 +678,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_LEFT. */ uint8_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = "Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0); @@ -687,7 +686,7 @@ test_xfunction (uint8_t * (*my_xasprintf) (const char *, ...)) } { /* FLAG_ZERO: no effect. */ uint8_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint8_t expected[] = " Rafa\305\202 Maszkowski 33"; ASSERT (result != NULL); ASSERT (u8_strcmp (result, expected) == 0);