5977114c42
. make common.o link with the tests instead of being #included as common.c . fix warnings about missing prototypes by declaring functions static . reduces some duplicated code Change-Id: Ic2a765d7f5886add5863190efec3fdd2d2ea2137
65 lines
1.1 KiB
C
65 lines
1.1 KiB
C
#include <errno.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#if defined(__clang__)
|
|
#pragma clang diagnostic ignored "-Wtautological-compare"
|
|
#endif
|
|
|
|
int max_error = 4;
|
|
#include "common.h"
|
|
|
|
|
|
/* 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
|
|
|
|
/* 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
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
start(45);
|
|
|
|
/* run long/unsigned long tests */
|
|
test_strtol();
|
|
test_strtoul();
|
|
|
|
/* run long long/unsigned long long tests */
|
|
test_strtoll();
|
|
test_strtoull();
|
|
|
|
quit();
|
|
return -1; /* never happens */
|
|
}
|