uselocale(0) regression test
[libc-test.git] / src / regression / uselocale-0.c
blobb84e996e76dfb9820d447940bc82b79b9e1940a8
1 // commit: 63f4b9f18f3674124d8bcb119739fec85e6da005
2 // uselocale(0) should not change the current locale
3 #include <locale.h>
4 #include "test.h"
6 int main(void)
8 locale_t c = newlocale(LC_ALL_MASK, "C", 0);
10 if (!c) {
11 t_error("newlocale failed\n");
12 return t_status;
15 if (!uselocale(c))
16 t_error("uselocale(c) failed\n");
18 locale_t l1 = uselocale(0);
19 if (l1 != c)
20 t_error("uselocale failed to set locale: "
21 "%p != %p\n", (void*)l1, (void*)c);
23 locale_t l2 = uselocale(0);
24 if (l2 != l1)
25 t_error("uselocale(0) changed locale: "
26 "%p != %p\n", (void*)l2, (void*)l1);
28 return t_status;