debug.h diffs, test driver

Thomas J Keller mc68020 at gilbbs.UUCP
Tue Sep 30 07:03:20 AEST 1986


   My friend who tested the debug program didn't test it quite as thouroughly
as he thought he did.  Here is a diff file to patch the error in the frpint
specification for the DCHAR macro.

   Also included is a crude but effective test driver program for testing the
macro package.

This is *NOT* a shell archive.

---------------------------------  cut here  ---------------------------------
43c43
< #        define	SPEC	'%03o'
---
> #        define	SPEC	"DBUG: %s: '%03o'\n"
45c45
< #	define	SPEC	0x%02x
---
> #	define	SPEC	"DEBUG: %s: 0x%02x\n"
70c70
< 			    fprintf(stderr, "DEBUG: %s SPEC\n", \
---
> 			    fprintf(stderr, SPEC, \

-----------------------------------  cut here  -------------------------------

#include	<stdio.h>
#include	<errno.h>

#define	DEBUG

#include	"debug.h"


extern int	errno;

main()

{

char		a;
unsigned char	b = '\077';
short int	c = 27;
unsigned short	d = 27;
int		e = 27;
unsigned int	f = 27;
long		g = 27L;
unsigned long	h = 27L;
float		i = 1.654E3;
char		k[15];

 
    a = '\000';
    DCHAR("testing DCHAR for null char", a);
    a = '\040';
    DCHAR("testing DCHAR for blank char", a);
    a = '\073';
    DCHAR("testing DCHAR for other values", a);
	
    DSHORT("testing DSHORT", c);
    DINT("testing DINT", e);
    DLONG("testing DLONG", g);
    DUCHAR("testing DUCHAR", b);
    DUSHORT("testing DUSHORT", d);
    DUINT("testing DUINT", f);
    DULONG("testing DULONG", h);
    DFLOAT("testing DFLOAT", i);
    strcpy(k, "");
    DSTRING("testing DSTRING for null string", k);
    strcpy(k, "test string");
    DSTRING("testing DSTRING for loaded string", k);
    DMSG("testing DMSG");
    DENTER("testing DENTER");
    DEXIT("testing DEXIT");
    DSTOP("testing DSTOP");
    write(e,k,15);
    DERROR("write(a,k,15)","testing DERROR");

    printf("debug test complete\n");

}

---------------------------------  cut here  ---------------------------------

-- 

Disclaimer:  Disclaimer?  DISCLAIMER!? I don't need no stinking DISCLAIMER!!!

tom keller					"She's alive, ALIVE!"
{ihnp4, dual}!ptsfa!gilbbs!mc68020

(* we may not be big, but we're small! *)



More information about the Comp.sources.bugs mailing list