1#include "shared.rsh"
2
3// Testing primitive types
4float floatTest = 1.99f;
5double doubleTest = 2.05;
6char charTest = -8;
7short shortTest = -16;
8int intTest = -32;
9long longTest = 17179869184l; // 1 << 34
10long long longlongTest = 68719476736l; // 1 << 36
11bool boolTest = false;
12
13rs_allocation allocationTest;
14int *intPtrTest;
15
16uchar ucharTest = 8;
17ushort ushortTest = 16;
18uint uintTest = 32;
19ulong ulongTest = 4611686018427387904L;
20int64_t int64_tTest = -17179869184l; // - 1 << 34
21uint64_t uint64_tTest = 117179869184l;
22
23void test_primitive_types() {
24    bool failed = false;
25    start();
26
27    _RS_ASSERT(floatTest == 2.99f);
28    _RS_ASSERT(doubleTest == 3.05);
29    _RS_ASSERT(charTest == -16);
30    _RS_ASSERT(shortTest == -32);
31    _RS_ASSERT(intTest == -64);
32    _RS_ASSERT(longTest == 17179869185l);
33    _RS_ASSERT(longlongTest == 68719476735l);
34
35    _RS_ASSERT(ucharTest == 8);
36    _RS_ASSERT(ushortTest == 16);
37    _RS_ASSERT(uintTest == 32);
38    _RS_ASSERT(ulongTest == 4611686018427387903L);
39    _RS_ASSERT(int64_tTest == -17179869184l);
40    _RS_ASSERT(uint64_tTest == 117179869185l);
41
42    float time = end();
43
44    if (failed) {
45        rsDebug("test_primitive_types FAILED", time);
46        rsSendToClientBlocking(RS_MSG_TEST_FAILED);
47    }
48    else {
49        rsDebug("test_primitive_types PASSED", time);
50        rsSendToClientBlocking(RS_MSG_TEST_PASSED);
51    }
52
53}
54