• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* crosstest.py --test=simple_loop.c --driver=simple_loop_main.c \
2    --prefix=Subzero_ --output=simple_loop */
3 
4 #include <stdio.h>
5 
6 int simple_loop(int *a, int n);
7 int Subzero_simple_loop(int *a, int n);
8 
main(int argc,char * argv[])9 int main(int argc, char *argv[]) {
10   unsigned TotalTests = 0;
11   unsigned Passes = 0;
12   unsigned Failures = 0;
13   int a[100];
14   for (int i = 0; i < 100; ++i)
15     a[i] = i * 2 - 100;
16   for (int i = -2; i < 100; ++i) {
17     ++TotalTests;
18     int llc_result = simple_loop(a, i);
19     int sz_result = Subzero_simple_loop(a, i);
20     if (llc_result == sz_result) {
21       ++Passes;
22     } else {
23       ++Failures;
24       printf("Failure: i=%d, llc=%d, sz=%d\n", i, llc_result, sz_result);
25     }
26   }
27   printf("TotalTests=%u Passes=%u Failures=%u\n", TotalTests, Passes, Failures);
28   return Failures;
29 }
30