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