]> pd.if.org Git - pdclib/blob - testing/_PDCLIB_test.h
printf_testcases: validate assumptions test cases make (todo soon: add support for...
[pdclib] / testing / _PDCLIB_test.h
1 /* $Id$ */
2
3 /* PDCLib testing suite <_PDCLIB_test.h>
4
5    This file is part of the Public Domain C Library (PDCLib).
6    Permission is granted to use, modify, and / or redistribute at will.
7 */
8
9 /* -------------------------------------------------------------------------- */
10 /* Helper macros for test drivers                                             */
11 /* -------------------------------------------------------------------------- */
12
13 #include <stdio.h>
14 #include <limits.h>
15 #include <string.h>
16 #include <assert.h>
17
18 /* Some strings used for <string.h> and <stdlib.h> testing. */
19 static char const abcde[] = "abcde";
20 static char const abcdx[] = "abcdx";
21 static char const teststring[] = "1234567890\nABCDEFGHIJKLMNOPQRSTUVWXYZ\nabcdefghijklmnopqrstuvwxyz\n";
22
23 /* Temporary file names */
24 static char const testfile[]="testing/testfile";
25 static char const testfile1[]="testing/testfile1";
26 static char const testfile2[]="testing/testfile2";
27
28 #define NO_TESTDRIVER 0
29
30 static int TEST_RESULTS = 0;
31
32 /* TESTCASE() - generic test */
33 #define TESTCASE( x ) if ( x ) {} \
34                       else { TEST_RESULTS += 1; printf( "FAILED: " __FILE__ ", line %d - %s\n", __LINE__, #x ); }
35
36 /* TESTCASE_NOREG() - PDCLib-only test */
37 #ifndef REGTEST
38     #define TESTCASE_NOREG( x ) TESTCASE( x )
39 #else
40     #define TESTCASE_NOREG( x )
41 #endif
42
43 /* Include printf() / scanf() test macros if required */
44
45 #if defined( _PDCLIB_FILEIO ) || defined( _PDCLIB_STRINGIO )
46 #include "_PDCLIB_iotest.h"
47 #endif
48