3 This file is part of the Public Domain C Library (PDCLib).
4 Permission is granted to use, modify, and / or redistribute at will.
12 #include "_PDCLIB_test.h"
14 typedef int (*intfunc_t)( void );
29 static int dummy( void )
34 static int test( enum tag_t s, ... )
45 TESTCASE( va_arg( ap, int ) == INT_MAX );
46 tag = va_arg( ap, enum tag_t );
51 TESTCASE( va_arg( ap, long ) == LONG_MAX );
52 tag = va_arg( ap, enum tag_t );
57 TESTCASE( va_arg( ap, long long ) == LLONG_MAX );
58 tag = va_arg( ap, enum tag_t );
63 TESTCASE( va_arg( ap, double ) == DBL_MAX );
64 tag = va_arg( ap, enum tag_t );
69 TESTCASE( va_arg( ap, long double ) == LDBL_MAX );
70 tag = va_arg( ap, enum tag_t );
75 TESTCASE( *( va_arg( ap, int * ) ) == INT_MAX );
76 tag = va_arg( ap, enum tag_t );
81 TESTCASE( *( va_arg( ap, long double * ) ) == LDBL_MAX );
82 tag = va_arg( ap, enum tag_t );
88 TESTCASE( ( function = va_arg( ap, intfunc_t ) ) == dummy );
89 TESTCASE( function() == INT_MAX );
90 tag = va_arg( ap, enum tag_t );
105 long double d = LDBL_MAX;
107 test( TAG_INT, INT_MAX, TAG_END );
108 test( TAG_LONG, LONG_MAX, TAG_LLONG, LLONG_MAX, TAG_END );
109 test( TAG_DBL, DBL_MAX, TAG_LDBL, LDBL_MAX, TAG_END );
110 test( TAG_INTPTR, &x, TAG_LDBLPTR, &d, TAG_FUNCPTR, dummy, TAG_END );