62 lines · c
1// RUN: %clang -std=c17 %s -o %t && %run %t2/// Test __isoc23_* for glibc 2.38+.3// RUN: %clang -std=c23 %s -o %t && %run %t4 5#include <assert.h>6#include <inttypes.h>7#include <stdio.h>8#include <stdlib.h>9#include <wchar.h>10 11#define TESTL(func) \12 { \13 char *end; \14 long l = (long)func("42", &end, 0); \15 assert(l == 42); \16 assert(*end == '\0'); \17 }18 19#define TESTF(func) \20 { \21 char *end; \22 long l = (long)func("42", &end); \23 assert(l == 42); \24 assert(*end == '\0'); \25 }26 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'); \33 }34 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'); \41 }42 43int 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);53 54 WTESTL(wcstol);55 WTESTL(wcstoll);56 WTESTL(wcstoul);57 WTESTL(wcstoull);58 WTESTF(wcstof);59 WTESTF(wcstod);60 WTESTF(wcstold);61}62