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