]> pd.if.org Git - pdclib/commitdiff
No exceptions to regtestdrivers anymore.
authorMartin Baute <solar@rootdirectory.de>
Thu, 17 Mar 2016 21:04:52 +0000 (22:04 +0100)
committerMartin Baute <solar@rootdirectory.de>
Thu, 17 Mar 2016 21:04:52 +0000 (22:04 +0100)
Makefile
functions/_PDCLIB/atomax.c
functions/_PDCLIB/closeall.c
functions/_PDCLIB/filemode.c
functions/_PDCLIB/prepread.c
functions/_PDCLIB/prepwrite.c
functions/_PDCLIB/print.c
functions/_PDCLIB/scan.c
functions/_PDCLIB/strtox_main.c
functions/_PDCLIB/strtox_prelim.c
platform/example/functions/_PDCLIB/allocpages.c

index 72f80717aa68e17dc4bbeee909a8891a55978b9e..0d0c8e0acbe29d4774f01626660580dd91cda9d2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,14 +7,12 @@ PROJDIRS := functions includes internals platform/example
 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)
index 2c860cfaa6fadcaa6d47db8013da853d0d5b6609..f05a8af8e074e2337e1defdb5b1ada90c49093fb 100644 (file)
@@ -4,10 +4,11 @@
    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;
@@ -25,15 +26,19 @@ _PDCLIB_intmax_t _PDCLIB_atomax( const char * s )
     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;
 }
 
index 0bc4278784b8a64089bdcca090cb76e63ee329b5..6c2bed4f1ba0f4e5b23944fc14b722e761942228 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <stdio.h>
 
+#ifndef REGTEST
+
 extern struct _PDCLIB_file_t * _PDCLIB_filelist;
 
 void _PDCLIB_closeall( void )
@@ -20,6 +22,8 @@ void _PDCLIB_closeall( void )
     }
 }
 
+#endif
+
 #ifdef TEST
 #include "_PDCLIB_test.h"
 
index 0eca3922681ee91d721152b6636bf669f9b3b905..9c3ec248f93eae3afc33639f39c9d16299508a73 100644 (file)
@@ -6,6 +6,8 @@
 
 #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).
@@ -52,11 +54,14 @@ unsigned int _PDCLIB_filemode( char const * const 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 ) );
@@ -76,6 +81,7 @@ int main( void )
     TESTCASE( _PDCLIB_filemode( "r++" ) == 0 );
     TESTCASE( _PDCLIB_filemode( "wbb" ) == 0 );
     TESTCASE( _PDCLIB_filemode( "a+bx" ) == 0 );
+#endif
     return TEST_RESULTS;
 }
 
index 345f70bf8283c2cc54456a28ff1b3a583d95bd2a..2c5818ae58b91adeffc74e3c4a6974d1239a5f3b 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <stdio.h>
 
+#ifndef REGTEST
 #include "_PDCLIB_glue.h"
 
 int _PDCLIB_prepread( struct _PDCLIB_file_t * stream )
@@ -33,6 +34,8 @@ int _PDCLIB_prepread( struct _PDCLIB_file_t * stream )
     }
 }
 
+#endif
+
 #ifdef TEST
 #include "_PDCLIB_test.h"
 
index fa46e46aa8e37a4e1a6bd99ca0d9a131db0eff9d..a901ccdaed39f10e4674ad727696c49c1341016e 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <stdio.h>
 
+#ifndef REGTEST
+
 int _PDCLIB_prepwrite( struct _PDCLIB_file_t * stream )
 {
     if ( ( stream->bufidx < stream->bufend ) || ( stream->ungetidx > 0 ) ||
@@ -24,6 +26,8 @@ int _PDCLIB_prepwrite( struct _PDCLIB_file_t * stream )
     return 0;
 }
 
+#endif
+
 #ifdef TEST
 #include "_PDCLIB_test.h"
 
index 076cbeddf1bb1040b9378da4d387646427e03701..768b4a60c060b8a6a1f1c7de959518c79caa2296 100644 (file)
@@ -10,6 +10,8 @@
 #include <stdlib.h>
 #include <stddef.h>
 
+#ifndef REGTEST
+
 /* Using an integer's bits as flags for both the conversion flags and length
    modifiers.
 */
@@ -513,12 +515,16 @@ const char * _PDCLIB_print( const char * spec, struct _PDCLIB_status_t * status
     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      */
@@ -542,13 +548,16 @@ static int testprintf( char * buffer, const char * format, ... )
     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;
 }
 
index 5d9d675601cc1b128dd3b6f8327cf07edc21ab49..7d11a9c27e1204155cf9358dcb9bed473e3994bf 100644 (file)
@@ -14,6 +14,8 @@
 #include <stddef.h>
 #include <limits.h>
 
+#ifndef REGTEST
+
 /* Using an integer's bits as flags for both the conversion flags and length
    modifiers.
 */
@@ -592,6 +594,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
     return NULL;
 }
 
+#endif
 
 #ifdef TEST
 #define _PDCLIB_FILEID "_PDCLIB/scan.c"
@@ -599,6 +602,7 @@ const char * _PDCLIB_scan( const char * spec, struct _PDCLIB_status_t * status )
 
 #include "_PDCLIB_test.h"
 
+#ifndef REGTEST
 static int testscanf( char const * s, char const * format, ... )
 {
     struct _PDCLIB_status_t status;
@@ -615,13 +619,16 @@ static int testscanf( char const * s, char const * format, ... )
     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;
 }
 
index accdb6f40788c761b5ef9181868acceb6a403155..3bfdbb8b5bf2d857dfff5c7ecda9ceafad88f041 100644 (file)
@@ -4,12 +4,13 @@
    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;
@@ -42,12 +43,15 @@ _PDCLIB_uintmax_t _PDCLIB_strtox_main( const char ** p, unsigned int base, uintm
     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";
@@ -75,6 +79,7 @@ int main( void )
     sign = '-';
     TESTCASE( _PDCLIB_strtox_main( &p, 10u, (uintmax_t)999, (uintmax_t)99, 8, &sign ) == 0 );
     TESTCASE( p == NULL );
+#endif
     return TEST_RESULTS;
 }
 
index 67625152103ad7ebfa6d982635214e6d2152de29..98f7fcea758145facf450f0aff74a6a767ebd7ea 100644 (file)
@@ -8,6 +8,8 @@
 #include <stddef.h>
 #include <string.h>
 
+#ifndef REGTEST
+
 const char * _PDCLIB_strtox_prelim( const char * p, char * sign, int * base )
 {
     /* skipping leading whitespace */
@@ -49,11 +51,14 @@ const char * _PDCLIB_strtox_prelim( const char * p, char * sign, int * base )
     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";
@@ -81,6 +86,7 @@ int main( void )
     TESTCASE( _PDCLIB_strtox_prelim( test3, &sign, &base ) == NULL );
     base = 37;
     TESTCASE( _PDCLIB_strtox_prelim( test3, &sign, &base ) == NULL );
+#endif
     return TEST_RESULTS;
 }
 
index 081adfb99993847b1d267cf882eb47ba348e7255..f3414bbb0bc8058925f0d67a8c107e0a894adbef 100644 (file)
@@ -11,6 +11,8 @@
 #include <stdint.h>
 #include <stddef.h>
 
+#ifndef REGTEST
+
 int brk( void * );
 void * sbrk( intptr_t );
 
@@ -53,13 +55,14 @@ void * _PDCLIB_allocpages( int const n )
     }
 }
 
+#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 );
@@ -70,7 +73,6 @@ int main( void )
     TESTCASE( sbrk( 0 ) == startbreak + ( 6 * _PDCLIB_PAGESIZE ) );
     TESTCASE( _PDCLIB_allocpages( -3 ) );
     TESTCASE( sbrk( 0 ) == startbreak + ( 3 * _PDCLIB_PAGESIZE ) );
-    }
 #endif
     return TEST_RESULTS;
 }