1#include "shared.rsh"
2
3// Testing primitive types
4float floatTest = 1.99f;
5float2 float2Test = {2.99f, 12.99f};
6float3 float3Test = {3.99f, 13.99f, 23.99f};
7float4 float4Test = {4.99f, 14.99f, 24.99f, 34.99f};
8double doubleTest = 2.05;
9char charTest = -8;
10short shortTest = -16;
11int intTest = -32;
12long longTest = 17179869184l; // 1 << 34
13long long longlongTest = 68719476736l; // 1 << 36
14
15uchar ucharTest = 8;
16ushort ushortTest = 16;
17uint uintTest = 32;
18ulong ulongTest = 4611686018427387904L;
19int64_t int64_tTest = -17179869184l; // - 1 << 34
20uint64_t uint64_tTest = 117179869184l;
21
22static bool basic_test(uint32_t index) {
23    bool failed = false;
24
25    // This test focuses primarily on compilation-time, not run-time.
26    // For this reason, none of the outputs are actually checked.
27
28    rsDebug("floatTest", floatTest);
29    rsDebug("float2Test", float2Test);
30    rsDebug("float3Test", float3Test);
31    rsDebug("float4Test", float4Test);
32    rsDebug("doubleTest", doubleTest);
33    rsDebug("charTest", charTest);
34    rsDebug("shortTest", shortTest);
35    rsDebug("intTest", intTest);
36    rsDebug("longTest", longTest);
37    rsDebug("longlongTest", longlongTest);
38
39    rsDebug("ucharTest", ucharTest);
40    rsDebug("ushortTest", ushortTest);
41    rsDebug("uintTest", uintTest);
42    rsDebug("ulongTest", ulongTest);
43    rsDebug("int64_tTest", int64_tTest);
44    rsDebug("uint64_tTest", uint64_tTest);
45
46    return failed;
47}
48
49void test_rsdebug(uint32_t index, int test_num) {
50    bool failed = false;
51    failed |= basic_test(index);
52
53    if (failed) {
54        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
55        rsDebug("rsdebug_test FAILED", -1);
56    }
57    else {
58        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
59        rsDebug("rsdebug_test PASSED", 0);
60    }
61}
62
63