Home | History | Annotate | Download | only in test
      1 #include "shared.rsh"
      2 
      3 int *a;
      4 int dimX;
      5 int dimY;
      6 
      7 void root(int *out, uint32_t x, uint32_t y) {
      8     *out = x + y * dimX;
      9 }
     10 
     11 static bool test_foreach_output() {
     12     bool failed = false;
     13     int i, j;
     14 
     15     for (j = 0; j < dimY; j++) {
     16         for (i = 0; i < dimX; i++) {
     17             _RS_ASSERT(a[i + j * dimX] == (i + j * dimX));
     18         }
     19     }
     20 
     21     if (failed) {
     22         rsDebug("test_foreach_output FAILED", 0);
     23     }
     24     else {
     25         rsDebug("test_foreach_output PASSED", 0);
     26     }
     27 
     28     return failed;
     29 }
     30 
     31 void foreach_test() {
     32     bool failed = false;
     33     failed |= test_foreach_output();
     34 
     35     if (failed) {
     36         rsSendToClientBlocking(RS_MSG_TEST_FAILED);
     37     }
     38     else {
     39         rsSendToClientBlocking(RS_MSG_TEST_PASSED);
     40     }
     41 }
     42 
     43