Mercurial > sdl-ios-xcode
annotate test/automated/platform/platform.c @ 4408:c5616d36b2ac gsoc2009_unit_tests
Closing obsolete gsoc2009_unit_tests named branch
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 28 Feb 2010 00:21:28 -0500 |
parents | 5b48a529fd8a |
children |
rev | line source |
---|---|
3736
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
1 /** |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
2 * Automated SDL platform test. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
3 * |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
4 * Based off of testplatform.c. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
5 * |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
6 * Written by Edgar Simo "bobbens" |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
7 * |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
8 * Released under Public Domain. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
9 */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
10 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
11 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
12 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
13 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
14 #include "SDL.h" |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
15 #include "SDL_at.h" |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
16 #include "SDL_endian.h" |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
17 #include "SDL_cpuinfo.h" |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
18 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
19 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
20 /* |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
21 * Prototypes. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
22 */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
23 static int plat_testSize( size_t sizeoftype, size_t hardcodetype ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
24 static void plat_testTypes (void); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
25 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
26 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
27 /** |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
28 * @brief Test size. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
29 * |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
30 * @note Watcom C flags these as Warning 201: "Unreachable code" if you just |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
31 * compare them directly, so we push it through a function to keep the |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
32 * compiler quiet. --ryan. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
33 */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
34 static int plat_testSize( size_t sizeoftype, size_t hardcodetype ) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
35 { |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
36 return sizeoftype != hardcodetype; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
37 } |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
38 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
39 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
40 /** |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
41 * @brief Tests type size. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
42 */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
43 static void plat_testTypes (void) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
44 { |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
45 int ret; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
46 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
47 SDL_ATbegin( "Type size" ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
48 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
49 ret = plat_testSize( sizeof(Uint8), 1 ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
50 if (SDL_ATvassert( ret == 0, "sizeof(Uint8) = %ul instead of 1", sizeof(Uint8) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
51 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
52 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
53 ret = plat_testSize( sizeof(Uint16), 2 ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
54 if (SDL_ATvassert( ret == 0, "sizeof(Uint16) = %ul instead of 2", sizeof(Uint16) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
55 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
56 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
57 ret = plat_testSize( sizeof(Uint32), 4 ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
58 if (SDL_ATvassert( ret == 0, "sizeof(Uint32) = %ul instead of 4", sizeof(Uint32) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
59 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
60 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
61 #ifdef SDL_HAS_64BIT_TYPE |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
62 ret = plat_testSize( sizeof(Uint64), 8 ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
63 if (SDL_ATvassert( ret == 0, "sizeof(Uint64) = %ul instead of 8", sizeof(Uint64) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
64 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
65 #endif /* SDL_HAS_64BIT_TYPE */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
66 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
67 SDL_ATend(); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
68 } |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
69 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
70 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
71 /** |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
72 * @brief Tests platform endianness. |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
73 */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
74 static void plat_testEndian (void) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
75 { |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
76 Uint16 value = 0x1234; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
77 int real_byteorder; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
78 Uint16 value16 = 0xCDAB; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
79 Uint16 swapped16 = 0xABCD; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
80 Uint32 value32 = 0xEFBEADDE; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
81 Uint32 swapped32 = 0xDEADBEEF; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
82 #ifdef SDL_HAS_64BIT_TYPE |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
83 Uint64 value64, swapped64; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
84 value64 = 0xEFBEADDE; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
85 value64 <<= 32; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
86 value64 |= 0xCDAB3412; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
87 swapped64 = 0x1234ABCD; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
88 swapped64 <<= 32; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
89 swapped64 |= 0xDEADBEEF; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
90 #endif |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
91 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
92 SDL_ATbegin( "Endianness" ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
93 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
94 /* Test endianness. */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
95 if ((*((char *) &value) >> 4) == 0x1) { |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
96 real_byteorder = SDL_BIG_ENDIAN; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
97 } else { |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
98 real_byteorder = SDL_LIL_ENDIAN; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
99 } |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
100 if (SDL_ATvassert( real_byteorder == SDL_BYTEORDER, |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
101 "Machine detected as %s endian but appears to be %s endian.", |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
102 (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big", |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
103 (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big" )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
104 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
105 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
106 /* Test 16 swap. */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
107 if (SDL_ATvassert( SDL_Swap16(value16) == swapped16, |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
108 "16 bit swapped incorrectly: 0x%X => 0x%X", |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
109 value16, SDL_Swap16(value16) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
110 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
111 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
112 /* Test 32 swap. */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
113 if (SDL_ATvassert( SDL_Swap32(value32) == swapped32, |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
114 "32 bit swapped incorrectly: 0x%X => 0x%X", |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
115 value32, SDL_Swap32(value32) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
116 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
117 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
118 #ifdef SDL_HAS_64BIT_TYPE |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
119 /* Test 64 swap. */ |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
120 if (SDL_ATvassert( SDL_Swap64(value64) == swapped64, |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
121 #ifdef _MSC_VER |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
122 "64 bit swapped incorrectly: 0x%I64X => 0x%I64X", |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
123 #else |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
124 "64 bit swapped incorrectly: 0x%llX => 0x%llX", |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
125 #endif |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
126 value64, SDL_Swap64(value64) )) |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
127 return; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
128 #endif |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
129 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
130 SDL_ATend(); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
131 } |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
132 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
133 |
3740
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
134 /** |
3753
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
135 * @brief Gets the name of the platform. |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
136 */ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
137 const char *platform_getPlatform (void) |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
138 { |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
139 return |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
140 #if __AIX__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
141 "AIX" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
142 #elif __BEOS__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
143 "BeOS" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
144 #elif __BSDI__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
145 "BSDI" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
146 #elif __DREAMCAST__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
147 "Dreamcast" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
148 #elif __FREEBSD__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
149 |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
150 "FreeBSD" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
151 #elif __HPUX__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
152 "HP-UX" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
153 #elif __IRIX__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
154 "Irix" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
155 #elif __LINUX__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
156 "Linux" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
157 #elif __MINT__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
158 "Atari MiNT" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
159 #elif __MACOS__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
160 "MacOS Classic" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
161 #elif __MACOSX__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
162 "Mac OS X" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
163 #elif __NETBSD__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
164 "NetBSD" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
165 #elif __OPENBSD__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
166 "OpenBSD" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
167 #elif __OS2__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
168 "OS/2" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
169 #elif __OSF__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
170 "OSF/1" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
171 #elif __QNXNTO__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
172 "QNX Neutrino" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
173 #elif __RISCOS__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
174 "RISC OS" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
175 #elif __SOLARIS__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
176 "Solaris" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
177 #elif __WIN32__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
178 #ifdef _WIN32_WCE |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
179 "Windows CE" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
180 #else |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
181 "Windows" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
182 #endif |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
183 #elif __IPHONEOS__ |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
184 "iPhone OS" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
185 #else |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
186 "an unknown operating system! (see SDL_platform.h)" |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
187 #endif |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
188 ; |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
189 } |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
190 |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
191 |
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
192 /** |
3740
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
193 * @brief Platform test entrypoint. |
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
194 */ |
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
195 #ifdef TEST_STANDALONE |
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
196 int main( int argc, const char *argv[] ) |
3736
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
197 { |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
198 (void) argc; |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
199 (void) argv; |
3740
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
200 #else /* TEST_STANDALONE */ |
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
201 int test_platform (void) |
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
202 { |
e451d5d288e9
Merged into one big app, while keeping modular applications also.
Edgar Simo <bobbens@gmail.com>
parents:
3736
diff
changeset
|
203 #endif /* TEST_STANDALONE */ |
3736
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
204 |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
205 SDL_ATinit( "Platform" ); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
206 |
3744
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
207 /* Debug information. */ |
3753
5b48a529fd8a
More debugging information when test fails.
Edgar Simo <bobbens@gmail.com>
parents:
3744
diff
changeset
|
208 SDL_ATprintVerbose( 1, "%s System detected\n", platform_getPlatform() ); |
3744
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
209 SDL_ATprintVerbose( 1, "System is %s endian\n", |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
210 #ifdef SDL_LIL_ENDIAN |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
211 "little" |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
212 #else |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
213 "big" |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
214 #endif |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
215 ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
216 SDL_ATprintVerbose( 1, "Available extensions:\n" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
217 SDL_ATprintVerbose( 1, " RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
218 SDL_ATprintVerbose( 1, " MMX %s\n", SDL_HasMMX()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
219 SDL_ATprintVerbose( 1, " MMX Ext %s\n", SDL_HasMMXExt()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
220 SDL_ATprintVerbose( 1, " 3DNow %s\n", SDL_Has3DNow()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
221 SDL_ATprintVerbose( 1, " 3DNow Ext %s\n", |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
222 SDL_Has3DNowExt()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
223 SDL_ATprintVerbose( 1, " SSE %s\n", SDL_HasSSE()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
224 SDL_ATprintVerbose( 1, " SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
225 SDL_ATprintVerbose( 1, " AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected" ); |
216e258f2842
Added more verbosity for platform test.
Edgar Simo <bobbens@gmail.com>
parents:
3741
diff
changeset
|
226 |
3736
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
227 plat_testTypes(); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
228 plat_testEndian(); |
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
229 |
3741
808fad5fb593
Added command line options.
Edgar Simo <bobbens@gmail.com>
parents:
3740
diff
changeset
|
230 return SDL_ATfinish(); |
3736
78f544eded7b
Added platform test based ot testplatform.c.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
231 } |