TCOV EXAMPLE OUTPUT
First File -- "CheckWord.c"
#include
#include
#include
#define MAXWORDS 4096
char *wordlist[MAXWORDS];
int wordcnt = 0;
int Check_Word( register char *word ) {
register int i;
char *newstring;
24760-> for( i=0; i if (strcmp(word,wordlist[i]) == 0)
24114-> return i;
}
646-> if (wordcnt>=MAXWORDS) {
@Not Used-> fprintf(stderr, "check_word: table overflow!\n");
exit(1);
}
646-> newstring = (char *)malloc(strlen(word)+1);
strcpy(newstring, word);
wordlist[wordcnt++] = newstring;
return 0;
}
6 Basic blocks in this file
5 Basic blocks executed
83.3333 Percentage of blocks executed
5210090 Total basic block executions
868348.3333 Executions per basic block
Second File: "main.c"
int main(int argc, char *argv[]) {
char wordbuff[128], *wp;
int ch;
int word_cnt = 0;
1-> ---^
while((ch = getchar()) != EOF) {
7-> ---^
1-> ---^
37683-> ---^
@Not Used-> ---^
37690-> if (isspace(ch) || ispunct(ch)) continue;
29280-> ---^
12930-> ---^
24760-> wp = wordbuff;
do {
106130-> *wp++ = ch;
ch = getchar();
106101-> ---^
29-> ---^
} while( !isspace(ch) && !ispunct(ch) );
106130-> ---^
85400-> ---^
24760-> *wp = Ô\0Õ;
if (Check_Word(wordbuff) == 0)
646-> word_cnt++;
}
1-> printf("There are %d distinct words\n", word_cnt );
return 0;
}
17 Basic blocks in this file
16 Basic blocks executed
94.1176 Percentage of blocks executed