FileDocCategorySizeDatePackage
UT_primitives.javaAPI DocAndroid 5.1 API2747Thu Mar 12 22:22:54 GMT 2015com.android.rs.test

UT_primitives

public class UT_primitives extends UnitTest

Fields Summary
private android.content.res.Resources
mRes
Constructors Summary
protected UT_primitives(RSTestCore rstc, android.content.res.Resources res, android.content.Context ctx)

        super(rstc, "Primitives", ctx);
        mRes = res;
    
Methods Summary
private booleaninitializeGlobals(ScriptC_primitives s)

        float pF = s.get_floatTest();
        if (pF != 1.99f) {
            return false;
        }
        s.set_floatTest(2.99f);

        double pD = s.get_doubleTest();
        if (pD != 2.05) {
            return false;
        }
        s.set_doubleTest(3.05);

        byte pC = s.get_charTest();
        if (pC != -8) {
            return false;
        }
        s.set_charTest((byte)-16);

        short pS = s.get_shortTest();
        if (pS != -16) {
            return false;
        }
        s.set_shortTest((short)-32);

        int pI = s.get_intTest();
        if (pI != -32) {
            return false;
        }
        s.set_intTest(-64);

        long pL = s.get_longTest();
        if (pL != 17179869184l) {
            return false;
        }
        s.set_longTest(17179869185l);

        long puL = s.get_ulongTest();
        if (puL != 4611686018427387904L) {
            return false;
        }
        s.set_ulongTest(4611686018427387903L);


        long pLL = s.get_longlongTest();
        if (pLL != 68719476736L) {
            return false;
        }
        s.set_longlongTest(68719476735L);

        long pu64 = s.get_uint64_tTest();
        if (pu64 != 117179869184l) {
            return false;
        }
        s.set_uint64_tTest(117179869185l);

        return true;
    
public voidrun()

        RenderScript pRS = RenderScript.create(mCtx);
        ScriptC_primitives s = new ScriptC_primitives(pRS);
        pRS.setMessageHandler(mRsMessage);
        if (!initializeGlobals(s)) {
            failTest();
        } else {
            s.invoke_primitives_test(0, 0);
            pRS.finish();
            waitForMessage();
        }
        pRS.destroy();