UT_constant.java revision 572a5031a5d8602db0bec0b253428a034bd4dd59
1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.rs.test;
18
19import android.content.Context;
20import android.content.res.Resources;
21import android.renderscript.*;
22
23public class UT_constant extends UnitTest {
24    private Resources mRes;
25
26    protected UT_constant(RSTestCore rstc, Resources res, Context ctx) {
27        super(rstc, "Const", ctx);
28        mRes = res;
29    }
30
31    private void Assert(boolean b) {
32        if (!b) {
33            failTest();
34        }
35    }
36
37    public void run() {
38        Assert(ScriptC_constant.const_floatTest == 1.99f);
39        Assert(ScriptC_constant.const_doubleTest == 2.05);
40        Assert(ScriptC_constant.const_charTest == -8);
41        Assert(ScriptC_constant.const_shortTest == -16);
42        Assert(ScriptC_constant.const_intTest == -32);
43        Assert(ScriptC_constant.const_longTest == 17179869184l);
44        Assert(ScriptC_constant.const_longlongTest == 68719476736l);
45
46        Assert(ScriptC_constant.const_ucharTest == 8);
47        Assert(ScriptC_constant.const_ushortTest == 16);
48        Assert(ScriptC_constant.const_uintTest == 32);
49        Assert(ScriptC_constant.const_ulongTest == 4611686018427387904L);
50        Assert(ScriptC_constant.const_int64_tTest == -17179869184l);
51        Assert(ScriptC_constant.const_uint64_tTest == 117179869184l);
52
53        Assert(ScriptC_constant.const_boolTest == true);
54
55        passTest();
56    }
57}
58