2009-12-09 20:01:38 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2011-11-14 11:07:49 +01:00
|
|
|
#if defined(__clang__)
|
|
|
|
#pragma clang diagnostic ignored "-Wtautological-compare"
|
|
|
|
#endif
|
|
|
|
|
2009-12-09 20:01:38 +01:00
|
|
|
#define MAX_ERROR 4
|
2011-12-16 15:45:53 +01:00
|
|
|
#include "common.c"
|
2009-12-09 20:01:38 +01:00
|
|
|
|
|
|
|
/* test strtol */
|
|
|
|
#define TYPE long
|
|
|
|
#define TYPEU unsigned long
|
|
|
|
#define TYPE_FUNC strtol
|
|
|
|
#include "test45.h"
|
|
|
|
#undef TYPE
|
|
|
|
#undef TYPEU
|
|
|
|
#undef TYPE_FUNC
|
|
|
|
|
|
|
|
/* test strtoul */
|
|
|
|
#define TYPE unsigned long
|
|
|
|
#define TYPEU unsigned long
|
|
|
|
#define TYPE_FUNC strtoul
|
|
|
|
#include "test45.h"
|
|
|
|
#undef TYPE
|
|
|
|
#undef TYPEU
|
|
|
|
#undef TYPE_FUNC
|
|
|
|
|
|
|
|
#ifdef __LONG_LONG_SUPPORTED
|
|
|
|
|
|
|
|
/* test strtoll */
|
|
|
|
#define TYPE long long
|
|
|
|
#define TYPEU unsigned long long
|
|
|
|
#define TYPE_FUNC strtoll
|
|
|
|
#include "test45.h"
|
|
|
|
#undef TYPE
|
|
|
|
#undef TYPEU
|
|
|
|
#undef TYPE_FUNC
|
|
|
|
|
|
|
|
/* test strtoull */
|
|
|
|
#define TYPE long long
|
|
|
|
#define TYPEU unsigned long long
|
|
|
|
#define TYPE_FUNC strtoull
|
|
|
|
#include "test45.h"
|
|
|
|
#undef TYPE
|
|
|
|
#undef TYPEU
|
|
|
|
#undef TYPE_FUNC
|
|
|
|
|
|
|
|
#endif /* defined(__LONG_LONG_SUPPORTED) */
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2011-12-16 15:45:53 +01:00
|
|
|
start(45);
|
2009-12-09 20:01:38 +01:00
|
|
|
#ifdef __LONG_LONG_SUPPORTED
|
2011-12-16 15:45:53 +01:00
|
|
|
printf("(GCC) ");
|
2009-12-09 20:01:38 +01:00
|
|
|
#else
|
2011-12-16 15:45:53 +01:00
|
|
|
printf("(ACK) ");
|
2009-12-09 20:01:38 +01:00
|
|
|
#endif
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
/* run long/unsigned long tests */
|
|
|
|
test_strtol();
|
|
|
|
test_strtoul();
|
|
|
|
|
|
|
|
/* run long long/unsigned long long tests (GCC only) */
|
|
|
|
#ifdef __LONG_LONG_SUPPORTED
|
|
|
|
test_strtoll();
|
|
|
|
test_strtoull();
|
|
|
|
#endif /* defined(__LONG_LONG_SUPPORTED) */
|
|
|
|
|
|
|
|
quit();
|
|
|
|
return -1; /* never happens */
|
|
|
|
}
|