+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.
#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>
struct locale_dependent_values
{
+#if HAVE_MONETARY_H
char monetary[100];
+#endif
char numeric[100];
char time[100];
};
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" */
{
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);
}
{
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);
}