mirror of
https://github.com/rzzzwilson/pymlac.git
synced 2025-06-10 09:32:41 +00:00
Better display of progress
This commit is contained in:
@@ -115,12 +115,21 @@ char *Progress[] = { "\r/",
|
||||
#define NUMELTS(a) (sizeof((a))/sizeof((a)[0]))
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Description : Show progress while we process tests.
|
||||
Parameters : lnum - line number
|
||||
Returns :
|
||||
Comments :
|
||||
******************************************************************************/
|
||||
void
|
||||
show_progress(void)
|
||||
show_progress(int lnum)
|
||||
{
|
||||
static int count = 0;
|
||||
int index = count++ % NUMELTS(Progress);
|
||||
char *p = Progress[index];
|
||||
// static int count = 0;
|
||||
// int index = count++ % NUMELTS(Progress);
|
||||
// char *p = Progress[index];
|
||||
char p[32];
|
||||
|
||||
sprintf(p, "\b\b\b\b\b\b\b\bTest %03d\r", lnum);
|
||||
|
||||
printf(p);
|
||||
fflush(stdout);
|
||||
@@ -894,8 +903,11 @@ parse_script(char *scriptpath)
|
||||
// read script file, handle each line
|
||||
while (true)
|
||||
{
|
||||
// bump line numebr to that next read in
|
||||
++line_number;
|
||||
|
||||
// some indication of progress
|
||||
show_progress();
|
||||
show_progress(line_number);
|
||||
|
||||
// NULL fill buffer so we can tell if line too long
|
||||
memset(buffer, (char) NULL, sizeof(buffer));
|
||||
@@ -905,7 +917,6 @@ parse_script(char *scriptpath)
|
||||
break;
|
||||
|
||||
// bump line number and make sure buffer '\0' terminated
|
||||
++line_number;
|
||||
buffer[MaxLineSize-1] = '\0';
|
||||
|
||||
// decide if line is too long, look for '\n'
|
||||
@@ -1160,7 +1171,7 @@ run(Test *test)
|
||||
while (test)
|
||||
{
|
||||
// some indication of progress
|
||||
show_progress();
|
||||
show_progress(test->line_number);
|
||||
|
||||
// echo test to log
|
||||
sprintf(buffer, "%03d", test->line_number);
|
||||
|
||||
@@ -14,7 +14,6 @@ main(int argc, char *argv[])
|
||||
{
|
||||
WORD addr;
|
||||
WORD result;
|
||||
FILE *fd;
|
||||
|
||||
// test the "memory clear" function
|
||||
mem_clear(0);
|
||||
@@ -115,15 +114,11 @@ main(int argc, char *argv[])
|
||||
mem_clear(0);
|
||||
for (addr = 0; addr < MEM_SIZE; ++addr)
|
||||
mem_put(addr, false, addr);
|
||||
fd = fopen("imlac.core", "wb");
|
||||
mem_save_core(fd);
|
||||
fclose(fd);
|
||||
mem_save_core("imlac.core");
|
||||
|
||||
// clear memory and read core file back in
|
||||
mem_clear(0);
|
||||
fd = fopen("imlac.core", "rb");
|
||||
mem_load_core(fd);
|
||||
fclose(fd);
|
||||
mem_load_core("imlac.core");
|
||||
for (addr = 0; addr < MEM_SIZE; ++addr)
|
||||
{
|
||||
if (mem_get(addr, false) != addr)
|
||||
|
||||
Reference in New Issue
Block a user