xref: /minix3/minix/tests/test45.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc #include <errno.h>
2*433d6423SLionel Sambuc #include <stdint.h>
3*433d6423SLionel Sambuc #include <stdio.h>
4*433d6423SLionel Sambuc #include <stdlib.h>
5*433d6423SLionel Sambuc #include <unistd.h>
6*433d6423SLionel Sambuc 
7*433d6423SLionel Sambuc #if defined(__clang__)
8*433d6423SLionel Sambuc #pragma clang diagnostic ignored "-Wtautological-compare"
9*433d6423SLionel Sambuc #endif
10*433d6423SLionel Sambuc 
11*433d6423SLionel Sambuc int max_error = 4;
12*433d6423SLionel Sambuc #include "common.h"
13*433d6423SLionel Sambuc 
14*433d6423SLionel Sambuc 
15*433d6423SLionel Sambuc /* test strtol */
16*433d6423SLionel Sambuc #define	TYPE        long
17*433d6423SLionel Sambuc #define	TYPEU       unsigned long
18*433d6423SLionel Sambuc #define	TYPE_FUNC	strtol
19*433d6423SLionel Sambuc #include "test45.h"
20*433d6423SLionel Sambuc #undef	TYPE
21*433d6423SLionel Sambuc #undef	TYPEU
22*433d6423SLionel Sambuc #undef	TYPE_FUNC
23*433d6423SLionel Sambuc 
24*433d6423SLionel Sambuc /* test strtoul */
25*433d6423SLionel Sambuc #define	TYPE        unsigned long
26*433d6423SLionel Sambuc #define	TYPEU       unsigned long
27*433d6423SLionel Sambuc #define	TYPE_FUNC	strtoul
28*433d6423SLionel Sambuc #include "test45.h"
29*433d6423SLionel Sambuc #undef	TYPE
30*433d6423SLionel Sambuc #undef	TYPEU
31*433d6423SLionel Sambuc #undef	TYPE_FUNC
32*433d6423SLionel Sambuc 
33*433d6423SLionel Sambuc /* test strtoll */
34*433d6423SLionel Sambuc #define	TYPE        long long
35*433d6423SLionel Sambuc #define	TYPEU       unsigned long long
36*433d6423SLionel Sambuc #define	TYPE_FUNC	strtoll
37*433d6423SLionel Sambuc #include "test45.h"
38*433d6423SLionel Sambuc #undef	TYPE
39*433d6423SLionel Sambuc #undef	TYPEU
40*433d6423SLionel Sambuc #undef	TYPE_FUNC
41*433d6423SLionel Sambuc 
42*433d6423SLionel Sambuc /* test strtoull */
43*433d6423SLionel Sambuc #define	TYPE        long long
44*433d6423SLionel Sambuc #define	TYPEU       unsigned long long
45*433d6423SLionel Sambuc #define	TYPE_FUNC	strtoull
46*433d6423SLionel Sambuc #include "test45.h"
47*433d6423SLionel Sambuc #undef	TYPE
48*433d6423SLionel Sambuc #undef	TYPEU
49*433d6423SLionel Sambuc #undef	TYPE_FUNC
50*433d6423SLionel Sambuc 
main(int argc,char ** argv)51*433d6423SLionel Sambuc int main(int argc, char **argv)
52*433d6423SLionel Sambuc {
53*433d6423SLionel Sambuc 	start(45);
54*433d6423SLionel Sambuc 
55*433d6423SLionel Sambuc 	/* run long/unsigned long tests */
56*433d6423SLionel Sambuc 	test_strtol();
57*433d6423SLionel Sambuc 	test_strtoul();
58*433d6423SLionel Sambuc 
59*433d6423SLionel Sambuc 	/* run long long/unsigned long long tests */
60*433d6423SLionel Sambuc 	test_strtoll();
61*433d6423SLionel Sambuc 	test_strtoull();
62*433d6423SLionel Sambuc 
63*433d6423SLionel Sambuc 	quit();
64*433d6423SLionel Sambuc 	return -1; /* never happens */
65*433d6423SLionel Sambuc }
66