Home | History | Annotate | Download | only in cts
      1 #include "shared.rsh"
      2 
      3 int *a;
      4 rs_allocation aRaw;
      5 int dimX;
      6 int dimY;
      7 static bool failed = false;
      8 
      9 void root(int *out, uint32_t x, uint32_t y) {
     10     *out = x + y * dimX;
     11 }
     12 
     13 void foo(const int *in, int *out, uint32_t x, uint32_t y) {
     14     _RS_ASSERT(*in == (x + y * dimX));
     15     *out = 99 + x + y * dimX;
     16     _RS_ASSERT(*out == (99 + x + y * dimX));
     17 }
     18 
     19 static bool test_root_output() {
     20     bool failed = false;
     21     int i, j;
     22 
     23     for (j = 0; j < dimY; j++) {
     24         for (i = 0; i < dimX; i++) {
     25             int v = rsGetElementAt_int(aRaw, i, j);
     26             _RS_ASSERT(v == (i + j * dimX));
     27         }
     28     }
     29 
     30     if (failed) {
     31         rsDebug("test_root_output FAILED", 0);
     32     }
     33     else {
     34         rsDebug("test_root_output PASSED", 0);
     35     }
     36 
     37     return failed;
     38 }
     39 
     40 static bool test_foo_output() {
     41     bool failed = false;
     42     int i, j;
     43 
     44     for (j = 0; j < dimY; j++) {
     45         for (i = 0; i < dimX; i++) {
     46             int v = rsGetElementAt_int(aRaw, i, j);
     47             _RS_ASSERT(v == (99 + i + j * dimX));
     48         }
     49     }
     50 
     51     if (failed) {
     52         rsDebug("test_foo_output FAILED", 0);
     53     }
     54     else {
     55         rsDebug("test_foo_output PASSED", 0);
     56     }
     57 
     58     return failed;
     59 }
     60 
     61 void verify_root() {
     62     failed |= test_root_output();
     63 }
     64 
     65 void verify_foo() {
     66     failed |= test_foo_output();
     67 }
     68 
     69 void foreach_test() {
     70     if (failed) {
     71         rsSendToClientBlocking(RS_MSG_TEST_FAILED);
     72     }
     73     else {
     74         rsSendToClientBlocking(RS_MSG_TEST_PASSED);
     75     }
     76 }
     77 
     78