Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / strtol.c
blob9947cdeacd8c315847088ee23ff9cfda6712cfe3
1 // RUN: %clang -std=c17 %s -o %t && %run %t
2 /// Test __isoc23_* for glibc 2.38+.
3 // RUN: %clang -std=c23 %s -o %t && %run %t
5 #include <assert.h>
6 #include <inttypes.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <wchar.h>
11 #define TESTL(func) \
12 { \
13 char *end; \
14 long l = (long)func("42", &end, 0); \
15 assert(l == 42); \
16 assert(*end == '\0'); \
19 #define TESTF(func) \
20 { \
21 char *end; \
22 long l = (long)func("42", &end); \
23 assert(l == 42); \
24 assert(*end == '\0'); \
27 #define WTESTL(func) \
28 { \
29 wchar_t *end; \
30 long l = (long)func(L"42", &end, 0); \
31 assert(l == 42); \
32 assert(*end == L'\0'); \
35 #define WTESTF(func) \
36 { \
37 wchar_t *end; \
38 long l = (long)func(L"42", &end); \
39 assert(l == 42); \
40 assert(*end == '\0'); \
43 int main() {
44 TESTL(strtol);
45 TESTL(strtoll);
46 TESTL(strtoimax);
47 TESTL(strtoul);
48 TESTL(strtoull);
49 TESTL(strtoumax);
50 TESTF(strtof);
51 TESTF(strtod);
52 TESTF(strtold);
54 WTESTL(wcstol);
55 WTESTL(wcstoll);
56 WTESTL(wcstoul);
57 WTESTL(wcstoull);
58 WTESTF(wcstof);
59 WTESTF(wcstod);
60 WTESTF(wcstold);