X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Funistdio%2Ftest-u16-printf1.h;h=b9f9244875e08ffb29d1ed1247d635f0dab1ad2f;hb=a8ec28b6975fc065b84c511b8108dc3658d2ccd4;hp=ee6449e9abb7c0754f9b1d0de1c26e628be1dfa1;hpb=2625ca90abe3246f6d3240d59d32f1843afc9651;p=gnulib.git diff --git a/tests/unistdio/test-u16-printf1.h b/tests/unistdio/test-u16-printf1.h index ee6449e9a..b9f924487 100644 --- a/tests/unistdio/test-u16-printf1.h +++ b/tests/unistdio/test-u16-printf1.h @@ -1,10 +1,10 @@ /* Test of u16_v[a]s[n]printf() function. Copyright (C) 2007 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. */ @@ -68,36 +67,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Hello"; { uint16_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -108,36 +107,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint16_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint16_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -148,36 +147,36 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint32_t unicode_string[] = { 'H', 'e', 'l', 'l', 'o', 0 }; { uint16_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%10llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-10llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; + { 'H', 'e', 'l', 'l', 'o', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%010llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; + { ' ', ' ', ' ', ' ', ' ', 'H', 'e', 'l', 'l', 'o', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -191,8 +190,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', - 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -204,8 +203,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %20s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -217,8 +216,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %-20s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', 'R', 'o', 'n', 'a', 'l', 'd', - ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', - ' ', ' ', ' ', ' ', ' ', '3', '3', 0 + ' ', 'R', 'e', 'a', 'g', 'a', 'n', ' ', ' ', ' ', + ' ', ' ', ' ', ' ', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -230,8 +229,8 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("Mr. %020s %d", "Ronald Reagan", 33, 44, 55); static const uint16_t expected[] = { 'M', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', - 'a', 'g', 'a', 'n', ' ', '3', '3', 0 + ' ', 'R', 'o', 'n', 'a', 'l', 'd', ' ', 'R', 'e', + 'a', 'g', 'a', 'n', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -254,9 +253,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -273,9 +272,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -284,29 +283,29 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10a %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -315,45 +314,45 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50a %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -362,25 +361,25 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%La %d", 3.1416015625L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', '9', '2', '2', 'p', '+', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '2', '4', '4', 'p', '+', '0', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected3[] = { '0', 'x', '6', '.', '4', '8', '8', 'p', '-', '1', - ' ', '3', '3', 0 + ' ', '3', '3', 0 }; static const uint16_t expected4[] = { '0', 'x', 'c', '.', '9', '1', 'p', '-', '2', ' ', - '3', '3', 0 + '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -397,9 +396,9 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { ' ', ' ', ' ', ' ', '0', 'x', 'e', 'p', '-', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -408,29 +407,29 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.10La %d", 1.75L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -439,45 +438,45 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%.50La %d", 1.75L, 33, 44, 55); static const uint16_t expected1[] = { '0', 'x', '1', '.', 'c', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '+', '0', ' ', '3', '3', + 0 }; static const uint16_t expected2[] = { '0', 'x', '3', '.', '8', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '1', ' ', '3', '3', + 0 }; static const uint16_t expected3[] = { '0', 'x', '7', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '2', ' ', '3', '3', + 0 }; static const uint16_t expected4[] = { '0', 'x', 'e', '.', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', - '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', - 0 + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', + '0', '0', '0', '0', 'p', '-', '3', ' ', '3', '3', + 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0 - || u16_strcmp (result, expected3) == 0 - || u16_strcmp (result, expected4) == 0); + || u16_strcmp (result, expected2) == 0 + || u16_strcmp (result, expected3) == 0 + || u16_strcmp (result, expected4) == 0); free (result); } @@ -592,15 +591,15 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%e %d", 12.75, 33, 44, 55); static const uint16_t expected1[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; static const uint16_t expected2[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '0', '1', ' ', '3', '3', 0 + '0', '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -609,15 +608,15 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15e %d", 1.75, 33, 44, 55); static const uint16_t expected1[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; static const uint16_t expected2[] = { ' ', ' ', '1', '.', '7', '5', '0', '0', '0', '0', - 'e', '+', '0', '0', '0', ' ', '3', '3', 0 + 'e', '+', '0', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -630,7 +629,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -639,7 +638,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%Le %d", 12.75L, 33, 44, 55); static const uint16_t expected[] = { '1', '.', '2', '7', '5', '0', '0', '0', 'e', '+', - '0', '1', ' ', '3', '3', 0 + '0', '1', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -651,7 +650,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) my_xasprintf ("%15Le %d", 1.75L, 33, 44, 55); static const uint16_t expected[] = { ' ', ' ', ' ', '1', '.', '7', '5', '0', '0', '0', - '0', 'e', '+', '0', '0', ' ', '3', '3', 0 + '0', 'e', '+', '0', '0', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); @@ -699,7 +698,7 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) { '1', 'e', '+', '0', '0', '3', ' ', '3', '3', 0 }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected1) == 0 - || u16_strcmp (result, expected2) == 0); + || u16_strcmp (result, expected2) == 0); free (result); } @@ -775,47 +774,47 @@ test_xfunction (uint16_t * (*my_xasprintf) (const char *, ...)) static const uint8_t unicode_string[] = "Rafa\305\202 Maszkowski"; /* Rafał Maszkowski */ { uint16_t *result = - my_xasprintf ("%U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020U %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -825,52 +824,52 @@ test_xfunction (uint16_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 }; { uint16_t *result = - my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020lU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); @@ -880,52 +879,52 @@ test_xfunction (uint16_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 }; { uint16_t *result = - my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* Width. */ uint16_t *result = - my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%20llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_LEFT. */ uint16_t *result = - my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%-20llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', - 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', - ' ', '3', '3', 0 - }; + { 'R', 'a', 'f', 'a', 0x0142, ' ', 'M', 'a', 's', 'z', + 'k', 'o', 'w', 's', 'k', 'i', ' ', ' ', ' ', ' ', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result); } { /* FLAG_ZERO: no effect. */ uint16_t *result = - my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); + my_xasprintf ("%020llU %d", unicode_string, 33, 44, 55); static const uint16_t expected[] = - { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', - 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', - ' ', '3', '3', 0 - }; + { ' ', ' ', ' ', ' ', 'R', 'a', 'f', 'a', 0x0142, ' ', + 'M', 'a', 's', 'z', 'k', 'o', 'w', 's', 'k', 'i', + ' ', '3', '3', 0 + }; ASSERT (result != NULL); ASSERT (u16_strcmp (result, expected) == 0); free (result);