1 /* Test variable number of arguments passed to functions. For now this is
2 just a simple test to see if it's working. */
27 /* This tests the argumentlist to see if it matches the format string which
28 is printf-like. Nothing will be printed of course. It can handle ints,
29 doubles and void pointers. The given value will be tested against the
30 values given in arglist.
31 This test only assures that the variable argument passing is working.
32 No attempt is made to see if argument passing is done the right way.
33 Since the ABI doesn't say how it's done, checking this is not really
36 my_noprintf (char *format
, ...)
44 struct arg
*argp
= arglist
;
46 va_start (va_arglist
, format
);
47 for (c
= format
; *c
; c
++)
53 assert (argp
->type
== ARG_INT
);
54 ivalue
= va_arg (va_arglist
, int);
55 assert (argp
->value
.ivalue
== ivalue
);
58 assert (argp
->type
== ARG_DOUBLE
);
59 dvalue
= va_arg (va_arglist
, double);
60 assert (argp
->value
.dvalue
== dvalue
);
63 assert (argp
->type
== ARG_POINTER
);
64 pvalue
= va_arg (va_arglist
, void *);
65 assert (argp
->value
.pvalue
== pvalue
);
82 al
[0].value
.ivalue
= 256;
83 al
[1].type
= ARG_DOUBLE
;
84 al
[1].value
.dvalue
= 257.0;
85 al
[2].type
= ARG_POINTER
;
86 al
[2].value
.pvalue
= al
;
87 al
[3].type
= ARG_DOUBLE
;
88 al
[3].value
.dvalue
= 258.0;
90 al
[4].value
.ivalue
= 259;
93 my_noprintf("%d%f%p%f%d", 256, 257.0, al
, 258.0, 259);