Search
lxdream.org :: lxdream/test/lib.c
lxdream 0.9.1
released Jun 29
Download Now
filename test/lib.c
changeset 185:6755a04c447f
next190:f7653df5e832
author nkeynes
date Tue Jul 11 01:35:27 2006 +0000 (15 years ago)
permissions -rw-r--r--
last change First commit of system test framework. 3 initial test cases (incomplete):
testide, testmath, and testta
file annotate diff log raw
nkeynes@185
     1
#include "lib.h"
nkeynes@185
     2
nkeynes@185
     3
void fwrite_dump( FILE *f, char *buf, int length)
nkeynes@185
     4
{
nkeynes@185
     5
    int i,j;
nkeynes@185
     6
    for( i=0; i<length; i+=16 ) {
nkeynes@185
     7
	fprintf( f, "%08X: ", i );
nkeynes@185
     8
        for( j=0; j<16 && i+j < length; j+=4 ) {
nkeynes@185
     9
	    unsigned int val = *((volatile unsigned int *)(buf+i+j));
nkeynes@185
    10
	    fprintf( f, "%02X %02X %02X %02X  ", val&0xFF, (val>>8)&0xFF, (val>>16)&0xFF, (val>>24)&0xFF );
nkeynes@185
    11
        }
nkeynes@185
    12
        for( ;j<16; j+= 4 ) {
nkeynes@185
    13
            fprintf( f, "             " );
nkeynes@185
    14
        }
nkeynes@185
    15
	for( j=0; j<16 && i+j < length; j++ ) {
nkeynes@185
    16
	    fprintf( f, "%c", isprint(buf[i+j]) ? buf[i+j] : '.' );
nkeynes@185
    17
	}
nkeynes@185
    18
	fprintf( f, "\n");
nkeynes@185
    19
    }
nkeynes@185
    20
}
.