commit 4aa1fb74928a33543c34f3f79c159ea3bfcb9be3
parent 2781c20326559bd605afd45cd71af26ddc6ffcf8
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Wed, 29 Apr 2026 15:30:39 +0200
tests/libc: Add 0076-localeconv
Diffstat:
3 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/tests/libc/execute/.gitignore b/tests/libc/execute/.gitignore
@@ -74,3 +74,4 @@ test.log
0073-mktime
0074-strftime
0075-strftime
+0076-localeconv
diff --git a/tests/libc/execute/0076-localeconv.c b/tests/libc/execute/0076-localeconv.c
@@ -0,0 +1,49 @@
+#include <assert.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdio.h>
+#include <string.h>
+
+/*
+output:
+testing
+done
+end:
+*/
+
+int
+main(void)
+{
+ struct lconv *lconv;
+ int ret;
+
+ puts("testing");
+ lconv = localeconv();
+ assert(lconv && strcmp(lconv->decimal_point, ".") == 0);
+ assert(lconv && *lconv->thousands_sep == '\0');
+ assert(lconv && *lconv->grouping == '\0');
+ assert(lconv && *lconv->mon_decimal_point == '\0');
+ assert(lconv && *lconv->mon_thousands_sep == '\0');
+ assert(lconv && *lconv->mon_grouping == '\0');
+ assert(lconv && *lconv->positive_sign == '\0');
+ assert(lconv && *lconv->negative_sign == '\0');
+ assert(lconv && *lconv->currency_symbol == '\0');
+ assert(lconv && *lconv->int_curr_symbol == '\0');
+ assert(lconv && lconv->frac_digits == CHAR_MAX);
+ assert(lconv && lconv->p_cs_precedes == CHAR_MAX);
+ assert(lconv && lconv->n_cs_precedes == CHAR_MAX);
+ assert(lconv && lconv->p_sep_by_space == CHAR_MAX);
+ assert(lconv && lconv->n_sep_by_space == CHAR_MAX);
+ assert(lconv && lconv->p_sign_posn == CHAR_MAX);
+ assert(lconv && lconv->n_sign_posn == CHAR_MAX);
+ assert(lconv && lconv->int_frac_digits == CHAR_MAX);
+ assert(lconv && lconv->int_p_cs_precedes == CHAR_MAX);
+ assert(lconv && lconv->int_n_cs_precedes == CHAR_MAX);
+ assert(lconv && lconv->int_p_sep_by_space == CHAR_MAX);
+ assert(lconv && lconv->int_n_sep_by_space == CHAR_MAX);
+ assert(lconv && lconv->int_p_sign_posn == CHAR_MAX);
+ assert(lconv && lconv->int_n_sign_posn == CHAR_MAX);
+ puts("done");
+
+ return 0;
+}
diff --git a/tests/libc/execute/libc-tests.lst b/tests/libc/execute/libc-tests.lst
@@ -72,3 +72,4 @@
0073-mktime
0074-strftime
0075-strftime
+0076-localeconv