blob: dc3efbc77425326979c8d653b2d3b9b2352b9e9c (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.rs.test_v11;
import android.content.Context;
import android.content.res.Resources;
import android.renderscript.*;
public class UT_primitives extends UnitTest {
private Resources mRes;
protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
super(rstc, "Primitives", ctx);
mRes = res;
}
private boolean initializeGlobals(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 void run() {
RenderScript pRS = RenderScript.create(mCtx);
ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
pRS.setMessageHandler(mRsMessage);
if (!initializeGlobals(s)) {
// initializeGlobals failed
result = -1;
} else {
s.invoke_primitives_test(0, 0);
pRS.finish();
waitForMessage();
}
pRS.destroy();
}
}
|