Mercurial > gnulib
changeset 40034:c844a0a9b36d
duplocale tests: Re-enable the test on platforms without <monetary.h>.
* tests/test-duplocale.c: Use more fine-grained #ifs to re-enable most
of the test, on platforms without <monetary.h>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 16 Dec 2018 06:45:51 +0100 |
parents | 507473ff985d |
children | 364175e15699 |
files | ChangeLog tests/test-duplocale.c |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Dec 16 05:40:53 2018 +0100 +++ b/ChangeLog Sun Dec 16 06:45:51 2018 +0100 @@ -1,3 +1,9 @@ +2018-12-16 Bruno Haible <bruno@clisp.org> + + duplocale tests: Re-enable the test on platforms without <monetary.h>. + * tests/test-duplocale.c: Use more fine-grained #ifs to re-enable most + of the test, on platforms without <monetary.h>. + 2018-12-16 Bruno Haible <bruno@clisp.org> localename: Update comments.
--- a/tests/test-duplocale.c Sun Dec 16 05:40:53 2018 +0100 +++ b/tests/test-duplocale.c Sun Dec 16 06:45:51 2018 +0100 @@ -20,13 +20,15 @@ #include <locale.h> -#if HAVE_DUPLOCALE && HAVE_MONETARY_H +#if HAVE_DUPLOCALE #include "signature.h" SIGNATURE_CHECK (duplocale, locale_t, (locale_t)); #include <langinfo.h> -#include <monetary.h> +#if HAVE_MONETARY_H +# include <monetary.h> +#endif #include <stdio.h> #include <string.h> @@ -34,7 +36,9 @@ struct locale_dependent_values { +#if HAVE_MONETARY_H char monetary[100]; +#endif char numeric[100]; char time[100]; }; @@ -42,9 +46,11 @@ static void get_locale_dependent_values (struct locale_dependent_values *result) { +#if HAVE_MONETARY_H strfmon (result->monetary, sizeof (result->monetary), "%n", 123.75); /* result->monetary is usually "$123.75" */ +#endif snprintf (result->numeric, sizeof (result->numeric), "%g", 3.5); /* result->numeric is usually "3,5" */ @@ -98,7 +104,9 @@ { struct locale_dependent_values results; get_locale_dependent_values (&results); +# if HAVE_MONETARY_H ASSERT (strcmp (results.monetary, expected_results.monetary) == 0); +# endif ASSERT (strcmp (results.numeric, expected_results.numeric) == 0); ASSERT (strcmp (results.time, expected_results.time) == 0); } @@ -110,7 +118,9 @@ { struct locale_dependent_values results; get_locale_dependent_values (&results); +# if HAVE_MONETARY_H ASSERT (strcmp (results.monetary, expected_results.monetary) == 0); +# endif ASSERT (strcmp (results.numeric, expected_results.numeric) == 0); ASSERT (strcmp (results.time, expected_results.time) == 0); }