5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 #include <_PDCLIB_test.h>
15 typedef int (*intfunc_t)( void );
30 static int test( enum tag_t s, ... )
41 TESTCASE( va_arg( ap, int ) == INT_MAX );
42 tag = va_arg( ap, enum tag_t );
47 TESTCASE( va_arg( ap, long ) == LONG_MAX );
48 tag = va_arg( ap, enum tag_t );
53 TESTCASE( va_arg( ap, long long ) == LLONG_MAX );
54 tag = va_arg( ap, enum tag_t );
59 TESTCASE( va_arg( ap, double ) == DBL_MAX );
60 tag = va_arg( ap, enum tag_t );
65 TESTCASE( va_arg( ap, long double ) == LDBL_MAX );
66 tag = va_arg( ap, enum tag_t );
71 TESTCASE( *( va_arg( ap, int * ) ) == INT_MAX );
72 tag = va_arg( ap, enum tag_t );
77 TESTCASE( *( va_arg( ap, long double * ) ) == LDBL_MAX );
78 tag = va_arg( ap, enum tag_t );
83 TESTCASE( (va_arg( ap, intfunc_t ))() == INT_MAX );
84 tag = va_arg( ap, enum tag_t );
96 static int dummy( void )
104 long double d = LDBL_MAX;
106 test( TAG_INT, INT_MAX, TAG_END );
107 test( TAG_LONG, LONG_MAX, TAG_LLONG, LLONG_MAX, TAG_END );
108 test( TAG_DBL, DBL_MAX, TAG_LDBL, LDBL_MAX, TAG_END );
109 test( TAG_INTPTR, &x, TAG_LDBLPTR, &d, TAG_FUNCPTR, dummy, TAG_END );