1#include "shared.rsh"
2#include "rs_graphics.rsh"
3
4rs_element elementTest;
5rs_type typeTest;
6rs_allocation allocationTest;
7rs_sampler samplerTest;
8rs_script scriptTest;
9rs_mesh meshTest;
10rs_program_fragment program_fragmentTest;
11rs_program_vertex program_vertexTest;
12rs_program_raster program_rasterTest;
13rs_program_store program_storeTest;
14rs_font fontTest;
15
16rs_matrix4x4 matrix4x4Test;
17rs_matrix3x3 matrix3x3Test;
18rs_matrix2x2 matrix2x2Test;
19
20struct my_struct {
21    int i;
22    rs_font fontTestStruct;
23};
24
25static bool basic_test(uint32_t index) {
26    bool failed = false;
27
28    rs_matrix4x4 matrix4x4TestLocal;
29    rs_matrix3x3 matrix3x3TestLocal;
30    rs_matrix2x2 matrix2x2TestLocal;
31    (void) matrix4x4TestLocal;
32    (void) matrix3x3TestLocal;
33    (void) matrix2x2TestLocal;
34
35    // This test focuses primarily on compilation-time, not run-time.
36    rs_element elementTestLocal;
37    rs_type typeTestLocal;
38    rs_allocation allocationTestLocal;
39    rs_sampler samplerTestLocal;
40    rs_script scriptTestLocal;
41    rs_mesh meshTestLocal;
42    rs_program_fragment program_fragmentTestLocal;
43    rs_program_vertex program_vertexTestLocal;
44    rs_program_raster program_rasterTestLocal;
45    rs_program_store program_storeTestLocal;
46    rs_font fontTestLocal;
47    (void) elementTestLocal;
48    (void) typeTestLocal;
49    (void) allocationTestLocal;
50    (void) samplerTestLocal;
51    (void) scriptTestLocal;
52    (void) meshTestLocal;
53    (void) program_fragmentTestLocal;
54    (void) program_vertexTestLocal;
55    (void) program_rasterTestLocal;
56    (void) program_storeTestLocal;
57    (void) fontTestLocal;
58
59    rs_font fontTestLocalArray[4];
60    (void) fontTestLocalArray;
61
62    rs_font fontTestLocalPreInit = fontTest;
63    (void) fontTestLocalPreInit;
64
65    struct my_struct structTest;
66    (void) structTest;
67
68    rsSetObject(&fontTestLocal, fontTest);
69    //allocationTestLocal = allocationTest;
70
71    rsSetObject(&fontTest, fontTestLocal);
72    //allocationTest = allocationTestLocal;
73
74    /*for (int i = 0; i < 4; i++) {
75        rsSetObject(&fontTestLocalArray[i], fontTestLocal);
76    }*/
77
78    /*rsSetObject(&fontTest, fontTestLocalArray[3]);*/
79
80    return failed;
81}
82
83void test_rstypes(uint32_t index, int test_num) {
84    bool failed = false;
85    failed |= basic_test(index);
86
87    if (failed) {
88        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
89        rsDebug("rstypes_test FAILED", -1);
90    }
91    else {
92        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
93        rsDebug("rstypes_test PASSED", 0);
94    }
95}
96