1// This file is automatically generated from
2// frameworks/rs/tests/java_api/RSUnitTests/RSUnitTests.py
3/*
4 * Copyright (C) 2017 The Android Open Source Project
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *      http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#include "shared.rsh"
20
21// Testing primitive types
22float floatTest = 1.99f;
23float2 float2Test = {2.99f, 12.99f};
24float3 float3Test = {3.99f, 13.99f, 23.99f};
25float4 float4Test = {4.99f, 14.99f, 24.99f, 34.99f};
26double doubleTest = 2.05;
27char charTest = -8;
28short shortTest = -16;
29int intTest = -32;
30long longTest = 17179869184l; // 1 << 34
31long long longlongTest = 68719476736l; // 1 << 36
32
33uchar ucharTest = 8;
34ushort ushortTest = 16;
35uint uintTest = 32;
36ulong ulongTest = 4611686018427387904L;
37int64_t int64_tTest = -17179869184l; // - 1 << 34
38uint64_t uint64_tTest = 117179869184l;
39
40static bool basic_test(uint32_t index) {
41    bool failed = false;
42
43    // This test focuses primarily on compilation-time, not run-time.
44    // For this reason, none of the outputs are actually checked.
45
46    rsDebug("floatTest", floatTest);
47    rsDebug("float2Test", float2Test);
48    rsDebug("float3Test", float3Test);
49    rsDebug("float4Test", float4Test);
50    rsDebug("doubleTest", doubleTest);
51    rsDebug("charTest", charTest);
52    rsDebug("shortTest", shortTest);
53    rsDebug("intTest", intTest);
54    rsDebug("longTest", longTest);
55    rsDebug("longlongTest", longlongTest);
56
57    rsDebug("ucharTest", ucharTest);
58    rsDebug("ushortTest", ushortTest);
59    rsDebug("uintTest", uintTest);
60    rsDebug("ulongTest", ulongTest);
61    rsDebug("int64_tTest", int64_tTest);
62    rsDebug("uint64_tTest", uint64_tTest);
63
64    return failed;
65}
66
67void test_rsdebug(uint32_t index, int test_num) {
68    bool failed = false;
69    failed |= basic_test(index);
70
71    if (failed) {
72        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
73        rsDebug("rsdebug_test FAILED", -1);
74    }
75    else {
76        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
77        rsDebug("rsdebug_test PASSED", 0);
78    }
79}
80
81