[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 10/11] duplocale: Fix Android build of duplocale-tests
From: |
Bruno Haible |
Subject: |
Re: [PATCH 10/11] duplocale: Fix Android build of duplocale-tests |
Date: |
Sun, 16 Dec 2018 06:50:45 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-139-generic; KDE/5.18.0; x86_64; ; ) |
Kevin Cernekee submitted this on 2015-02-12:
> diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c
> index f5da517bf3f8..18913f1b8b7d 100644
> --- a/tests/test-duplocale.c
> +++ b/tests/test-duplocale.c
> @@ -20,7 +20,7 @@
>
> #include <locale.h>
>
> -#if HAVE_DUPLOCALE
> +#if HAVE_DUPLOCALE && HAVE_MONETARY_H
>
> #include "signature.h"
> SIGNATURE_CHECK (duplocale, locale_t, (locale_t));
>
This disables the test on OpenBSD >= 6.2, which does have duplocale()
but no <monetary.h>. Better disable only the parts that would not compile.
2018-12-16 Bruno Haible <address@hidden>
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>.
diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c
index 9946392..1cf1089 100644
--- a/tests/test-duplocale.c
+++ b/tests/test-duplocale.c
@@ -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 @@ SIGNATURE_CHECK (duplocale, locale_t, (locale_t));
struct locale_dependent_values
{
+#if HAVE_MONETARY_H
char monetary[100];
+#endif
char numeric[100];
char time[100];
};
@@ -42,9 +46,11 @@ struct locale_dependent_values
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 @@ test_with_uselocale (void)
{
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 @@ test_with_uselocale (void)
{
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);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 10/11] duplocale: Fix Android build of duplocale-tests,
Bruno Haible <=