• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 #include <CUnit/Basic.h>
3 
4 void iwkvd_trigger_xor(uint64_t val);
5 
6 
cmp_files(FILE * f1,FILE * f2)7 static int cmp_files(FILE *f1, FILE *f2) {
8   CU_ASSERT_TRUE_FATAL(f1 && f2);
9   fseek(f1, 0, SEEK_SET);
10   fseek(f2, 0, SEEK_SET);
11   char c1 = getc(f1);
12   char c2 = getc(f2);
13   int pos = 0, line = 1;
14   while (c1 != EOF && c2 != EOF) {
15     pos++;
16     if (c1 == '\n' && c2 == '\n') {
17       line++;
18       pos = 0;
19     } else if (c1 != c2) {
20       fprintf(stderr, "\nDiff at: %d:%d\n", line, pos);
21       return (c1 - c2);
22     }
23     c1 = getc(f1);
24     c2 = getc(f2);
25   }
26   if (c1 - c2) {
27     fprintf(stderr, "\nDiff at: %d:%d\n", line, pos);
28   }
29   return (c1 - c2);
30 }
31