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 11 12uchar ucharTest = 8; 13ushort ushortTest = 16; 14uint uintTest = 32; 15ulong ulongTest = 4611686018427387904L; 16int64_t int64_tTest = -17179869184l; // - 1 << 34 17uint64_t uint64_tTest = 117179869184l; 18 19static bool test_primitive_types(uint32_t index) { 20 bool failed = false; 21 start(); 22 23 _RS_ASSERT(floatTest == 2.99f); 24 _RS_ASSERT(doubleTest == 3.05); 25 _RS_ASSERT(charTest == -16); 26 _RS_ASSERT(shortTest == -32); 27 _RS_ASSERT(intTest == -64); 28 _RS_ASSERT(longTest == 17179869185l); 29 _RS_ASSERT(longlongTest == 68719476735l); 30 31 _RS_ASSERT(ucharTest == 8); 32 _RS_ASSERT(ushortTest == 16); 33 _RS_ASSERT(uintTest == 32); 34 _RS_ASSERT(ulongTest == 4611686018427387903L); 35 _RS_ASSERT(int64_tTest == -17179869184l); 36 _RS_ASSERT(uint64_tTest == 117179869185l); 37 38 float time = end(index); 39 40 if (failed) { 41 rsDebug("test_primitives FAILED", time); 42 } 43 else { 44 rsDebug("test_primitives PASSED", time); 45 } 46 47 return failed; 48} 49 50void primitives_test(uint32_t index, int test_num) { 51 bool failed = false; 52 failed |= test_primitive_types(index); 53 54 if (failed) { 55 rsSendToClientBlocking(RS_MSG_TEST_FAILED); 56 } 57 else { 58 rsSendToClientBlocking(RS_MSG_TEST_PASSED); 59 } 60} 61 62