summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs
blob: 3ba3eef1bbc8f08b6dbe80f0e3b8b7b22d1a4cae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "shared.rsh"

int *a;
int dimX;
int dimY;

void root(int *out, uint32_t x, uint32_t y) {
    *out = x + y * dimX;
}

static bool test_foreach_output() {
    bool failed = false;
    int i, j;

    for (j = 0; j < dimY; j++) {
        for (i = 0; i < dimX; i++) {
            _RS_ASSERT(a[i + j * dimX] == (i + j * dimX));
        }
    }

    if (failed) {
        rsDebug("test_foreach_output FAILED", 0);
    }
    else {
        rsDebug("test_foreach_output PASSED", 0);
    }

    return failed;
}

void foreach_test() {
    bool failed = false;
    failed |= test_foreach_output();

    if (failed) {
        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
    }
    else {
        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
    }
}