diff options
Diffstat (limited to 'tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs')
-rw-r--r-- | tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs new file mode 100644 index 0000000..3ba3eef --- /dev/null +++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs @@ -0,0 +1,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); + } +} + |