SRCFILES := $(shell find -L $(PROJDIRS) -type f -name "*.c")
# All header files of the project
HDRFILES := $(shell find -L $(PROJDIRS) -type f -name "*.h")
-# All .c files in functions/_PDCLIB that do not have a regression test driver
-INTFILES := _Exit atomax digits open print scan remove rename seed stdinit strtox_main strtox_prelim filemode eol errno seek prepread prepwrite allocpages tmpfilename closeall
# All object files in the library
OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
# All test drivers (.t)
TSTFILES := $(patsubst %.c,%_t,$(SRCFILES))
# All regression test drivers (.r)
-REGFILES := $(filter-out $(patsubst %,functions/_PDCLIB/%_r,$(INTFILES)),$(patsubst %.c,%_r,$(SRCFILES)))
+REGFILES := $(patsubst %.c,%_r,$(SRCFILES))
# All library dependency files (.d)
DEPFILES := $(patsubst %.c,%.d,$(SRCFILES))
# All test driver dependency files (_t.d)
Permission is granted to use, modify, and / or redistribute at will.
*/
-#include "_PDCLIB_int.h"
#include <string.h>
#include <ctype.h>
+#ifndef REGTEST
+
_PDCLIB_intmax_t _PDCLIB_atomax( const char * s )
{
_PDCLIB_intmax_t rc = 0;
return ( sign == '+' ) ? rc : -rc;
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
int main( void )
{
+#ifndef REGTEST
/* basic functionality */
TESTCASE( _PDCLIB_atomax( "123" ) == 123 );
/* testing skipping of leading whitespace and trailing garbage */
TESTCASE( _PDCLIB_atomax( " \n\v\t\f123xyz" ) == 123 );
+#endif
return TEST_RESULTS;
}
#include <stdio.h>
+#ifndef REGTEST
+
extern struct _PDCLIB_file_t * _PDCLIB_filelist;
void _PDCLIB_closeall( void )
}
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
#include <stddef.h>
+#ifndef REGTEST
+
/* Helper function that parses the C-style mode string passed to fopen() into
the PDCLib flags FREAD, FWRITE, FAPPEND, FRW (read-write) and FBIN (binary
mode).
return 0;
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
int main( void )
{
+#ifndef REGTEST
TESTCASE( _PDCLIB_filemode( "r" ) == _PDCLIB_FREAD );
TESTCASE( _PDCLIB_filemode( "w" ) == _PDCLIB_FWRITE );
TESTCASE( _PDCLIB_filemode( "a" ) == ( _PDCLIB_FAPPEND | _PDCLIB_FWRITE ) );
TESTCASE( _PDCLIB_filemode( "r++" ) == 0 );
TESTCASE( _PDCLIB_filemode( "wbb" ) == 0 );
TESTCASE( _PDCLIB_filemode( "a+bx" ) == 0 );
+#endif
return TEST_RESULTS;
}
#include <stdio.h>
+#ifndef REGTEST
#include "_PDCLIB_glue.h"
int _PDCLIB_prepread( struct _PDCLIB_file_t * stream )
}
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
#include <stdio.h>
+#ifndef REGTEST
+
int _PDCLIB_prepwrite( struct _PDCLIB_file_t * stream )
{
if ( ( stream->bufidx < stream->bufend ) || ( stream->ungetidx > 0 ) ||
return 0;
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
#include <stdlib.h>
#include <stddef.h>
+#ifndef REGTEST
+
/* Using an integer's bits as flags for both the conversion flags and length
modifiers.
*/
return ++spec;
}
+#endif
+
#ifdef TEST
#define _PDCLIB_FILEID "_PDCLIB/print.c"
#define _PDCLIB_STRINGIO
#include "_PDCLIB_test.h"
+#ifndef REGTEST
+
static int testprintf( char * buffer, const char * format, ... )
{
/* Members: base, flags, n, i, current, s, width, prec, stream, arg */
va_end( status.arg );
return status.i;
}
+#endif
#define TEST_CONVERSION_ONLY
int main( void )
{
+#ifndef REGTEST
char target[100];
#include "printf_testcases.h"
+#endif
return TEST_RESULTS;
}
#include <stddef.h>
#include <limits.h>
+#ifndef REGTEST
+
/* Using an integer's bits as flags for both the conversion flags and length
modifiers.
*/
return NULL;
}
+#endif
#ifdef TEST
#define _PDCLIB_FILEID "_PDCLIB/scan.c"
#include "_PDCLIB_test.h"
+#ifndef REGTEST
static int testscanf( char const * s, char const * format, ... )
{
struct _PDCLIB_status_t status;
va_end( status.arg );
return status.n;
}
+#endif
#define TEST_CONVERSION_ONLY
int main( void )
{
+#ifndef REGTEST
char source[100];
#include "scanf_testcases.h"
+#endif
return TEST_RESULTS;
}
Permission is granted to use, modify, and / or redistribute at will.
*/
-#include "_PDCLIB_int.h"
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <stdint.h>
+#ifndef REGTEST
+
_PDCLIB_uintmax_t _PDCLIB_strtox_main( const char ** p, unsigned int base, uintmax_t error, uintmax_t limval, int limdigit, char * sign )
{
_PDCLIB_uintmax_t rc = 0;
return rc;
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
#include <errno.h>
int main( void )
{
+#ifndef REGTEST
const char * p;
char test[] = "123_";
char fail[] = "xxx";
sign = '-';
TESTCASE( _PDCLIB_strtox_main( &p, 10u, (uintmax_t)999, (uintmax_t)99, 8, &sign ) == 0 );
TESTCASE( p == NULL );
+#endif
return TEST_RESULTS;
}
#include <stddef.h>
#include <string.h>
+#ifndef REGTEST
+
const char * _PDCLIB_strtox_prelim( const char * p, char * sign, int * base )
{
/* skipping leading whitespace */
return ( ( *base >= 2 ) && ( *base <= 36 ) ) ? p : NULL;
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
int main( void )
{
+#ifndef REGTEST
int base = 0;
char sign = '\0';
char test1[] = " 123";
TESTCASE( _PDCLIB_strtox_prelim( test3, &sign, &base ) == NULL );
base = 37;
TESTCASE( _PDCLIB_strtox_prelim( test3, &sign, &base ) == NULL );
+#endif
return TEST_RESULTS;
}
#include <stdint.h>
#include <stddef.h>
+#ifndef REGTEST
+
int brk( void * );
void * sbrk( intptr_t );
}
}
+#endif
+
#ifdef TEST
#include "_PDCLIB_test.h"
int main( void )
{
#ifndef REGTEST
- {
char * startbreak = sbrk( 0 );
TESTCASE( _PDCLIB_allocpages( 0 ) );
TESTCASE( ( (char *)sbrk( 0 ) - startbreak ) <= _PDCLIB_PAGESIZE );
TESTCASE( sbrk( 0 ) == startbreak + ( 6 * _PDCLIB_PAGESIZE ) );
TESTCASE( _PDCLIB_allocpages( -3 ) );
TESTCASE( sbrk( 0 ) == startbreak + ( 3 * _PDCLIB_PAGESIZE ) );
- }
#endif
return TEST_RESULTS;
}