Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f884ed2 authored by Stephen Hines's avatar Stephen Hines Committed by Android (Google) Code Review
Browse files

Merge "Add tests for the new clipped kernel Java reflection."

parents c932760f 37352bb9
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -33,6 +33,10 @@ public class UT_foreach_bounds extends UnitTest {
        Type.Builder typeBuilder = new Type.Builder(RS, Element.I32(RS));
        int X = 5;
        int Y = 7;
        final int xStart = 2;
        final int xEnd = 5;
        final int yStart = 3;
        final int yEnd = 6;
        s.set_dimX(X);
        s.set_dimY(Y);
        typeBuilder.setX(X).setY(Y);
@@ -41,12 +45,16 @@ public class UT_foreach_bounds extends UnitTest {
        s.set_s(s);
        s.set_ain(A);
        s.set_aout(A);
        s.set_xStart(2);
        s.set_xEnd(5);
        s.set_yStart(3);
        s.set_yEnd(6);
        s.set_xStart(xStart);
        s.set_xEnd(xEnd);
        s.set_yStart(yStart);
        s.set_yEnd(yEnd);
        s.forEach_zero(A);

        Script.LaunchOptions sc = new Script.LaunchOptions();
        sc.setX(xStart, xEnd).setY(yStart, yEnd);
        s.forEach_root(A, sc);

        return;
    }

@@ -55,6 +63,7 @@ public class UT_foreach_bounds extends UnitTest {
        ScriptC_foreach_bounds s = new ScriptC_foreach_bounds(pRS);
        pRS.setMessageHandler(mRsMessage);
        initializeGlobals(pRS, s);
        s.invoke_verify_root();
        s.invoke_foreach_bounds_test();
        pRS.finish();
        waitForMessage();
+5 −15
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ int xEnd = 0;
int yStart = 0;
int yEnd = 0;

static bool failed = false;

rs_script s;
rs_allocation aRaw;
rs_allocation ain;
@@ -27,9 +29,6 @@ static bool test_root_output() {
    for (j = 0; j < dimY; j++) {
        for (i = 0; i < dimX; i++) {
            int v = rsGetElementAt_int(aRaw, i, j);
            rsDebug("i: ", i);
            rsDebug("j: ", j);
            rsDebug("a[j][i]: ", v);
            if (i < xStart || i >= xEnd || j < yStart || j >= yEnd) {
                _RS_ASSERT(v == 0);
            } else {
@@ -48,20 +47,11 @@ static bool test_root_output() {
    return failed;
}

void foreach_bounds_test() {
    static bool failed = false;

    rs_script_call_t rssc = {0};
    rssc.strategy = RS_FOR_EACH_STRATEGY_DONT_CARE;
    rssc.xStart = xStart;
    rssc.xEnd = xEnd;
    rssc.yStart = yStart;
    rssc.yEnd = yEnd;

    rsForEach(s, ain, aout, NULL, 0, &rssc);

void verify_root() {
    failed |= test_root_output();
}

void foreach_bounds_test() {
    if (failed) {
        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
    }