Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
577 lines (473 loc) · 18.3 KB

testautomation_rwops.c

File metadata and controls

577 lines (473 loc) · 18.3 KB
 
Dec 31, 2012
Dec 31, 2012
1
2
3
4
5
6
/**
* Automated SDL_RWops test.
*
* Original code written by Edgar Simo "bobbens"
* Ported by Markus Kauppila (markus.kauppila@gmail.com)
Jan 21, 2013
Jan 21, 2013
7
* Updated and extended for SDL_test by aschiffler at ferzkopp dot net
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
*
* Released under Public Domain.
*/
/* quiet windows compiler warnings */
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include "SDL.h"
#include "SDL_test.h"
/* ================= Test Case Implementation ================== */
const char* RWopsReadTestFilename = "rwops_read";
const char* RWopsWriteTestFilename = "rwops_write";
static const char RWopsHelloWorldTestString[] = "Hello World!";
static const char RWopsHelloWorldCompString[] = "Hello World!";
/* Fixture */
void
RWopsSetUp(void *arg)
{
int fileLen = SDL_strlen(RWopsHelloWorldTestString);
FILE *handle;
int writtenLen;
int result;
/* Clean up from previous runs (if any); ignore errors */
remove(RWopsReadTestFilename);
remove(RWopsWriteTestFilename);
/* Create a test file */
handle = fopen(RWopsReadTestFilename, "w");
SDLTest_AssertCheck(handle != NULL, "Verify creation of file '%s' returned non NULL handle", RWopsReadTestFilename);
Jan 21, 2013
Jan 21, 2013
45
if (handle == NULL) return;
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Write some known test into it */
writtenLen = (int)fwrite(RWopsHelloWorldTestString, 1, fileLen, handle);
SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen);
result = fclose(handle);
SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result);
SDLTest_AssertPass("Creation of test file completed");
}
void
RWopsTearDown(void *arg)
{
int result;
/* Remove the created files to clean up; ignore errors for write filename */
result = remove(RWopsReadTestFilename);
SDLTest_AssertCheck(result == 0, "Verify result from remove(%s), expected 0, got %i", RWopsReadTestFilename, result);
remove(RWopsWriteTestFilename);
SDLTest_AssertPass("Cleanup of test files completed");
}
/**
* @brief Makes sure parameters work properly. Local helper function.
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWseek
* http://wiki.libsdl.org/moin.cgi/SDL_RWread
*/
void
_testGenericRWopsValidations(SDL_RWops *rw, int write)
{
char buf[sizeof(RWopsHelloWorldTestString)];
Dec 30, 2012
Dec 30, 2012
80
Sint64 i;
Mar 12, 2013
Mar 12, 2013
81
size_t s;
82
83
84
85
86
87
88
89
int seekPos = SDLTest_RandomIntegerInRange(4, 8);
/* Clear buffer */
SDL_zero(buf);
/* Set to start. */
i = SDL_RWseek(rw, 0, RW_SEEK_SET );
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
Dec 30, 2012
Dec 30, 2012
90
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i);
Mar 12, 2013
Mar 12, 2013
93
s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1);
94
95
SDLTest_AssertPass("Call to SDL_RWwrite succeeded");
if (write) {
Mar 12, 2013
Mar 12, 2013
96
SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", s);
Mar 12, 2013
Mar 12, 2013
99
SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", s);
100
101
102
103
104
}
/* Test seek to random position */
i = SDL_RWseek( rw, seekPos, RW_SEEK_SET );
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
Dec 30, 2012
Dec 30, 2012
105
SDLTest_AssertCheck(i == (Sint64)seekPos, "Verify seek to %i with SDL_RWseek (RW_SEEK_SET), expected %i, got %i", seekPos, seekPos, i);
106
107
108
109
/* Test seek back to start */
i = SDL_RWseek(rw, 0, RW_SEEK_SET );
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
Dec 30, 2012
Dec 30, 2012
110
SDLTest_AssertCheck(i == (Sint64)0, "Verify seek to 0 with SDL_RWseek (RW_SEEK_SET), expected 0, got %i", i);
Mar 12, 2013
Mar 12, 2013
113
s = SDL_RWread( rw, buf, 1, sizeof(RWopsHelloWorldTestString)-1 );
114
115
SDLTest_AssertPass("Call to SDL_RWread succeeded");
SDLTest_AssertCheck(
Mar 12, 2013
Mar 12, 2013
116
s == (size_t)(sizeof(RWopsHelloWorldTestString)-1),
117
118
"Verify result from SDL_RWread, expected %i, got %i",
sizeof(RWopsHelloWorldTestString)-1,
Mar 12, 2013
Mar 12, 2013
119
s);
120
121
122
123
124
125
126
127
SDLTest_AssertCheck(
SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1 ) == 0,
"Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf);
/* More seek tests. */
i = SDL_RWseek( rw, -4, RW_SEEK_CUR );
SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded");
SDLTest_AssertCheck(
Dec 30, 2012
Dec 30, 2012
128
i == (Sint64)(sizeof(RWopsHelloWorldTestString)-5),
129
130
131
132
133
134
135
"Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i",
sizeof(RWopsHelloWorldTestString)-5,
i);
i = SDL_RWseek( rw, -1, RW_SEEK_END );
SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded");
SDLTest_AssertCheck(
Dec 30, 2012
Dec 30, 2012
136
i == (Sint64)(sizeof(RWopsHelloWorldTestString)-2),
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
"Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i",
sizeof(RWopsHelloWorldTestString)-2,
i);
}
/*!
* Negative test for SDL_RWFromFile parameters
*
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
*
*/
int
rwops_testParamNegative (void)
{
SDL_RWops *rwops;
/* These should all fail. */
rwops = SDL_RWFromFile(NULL, NULL);
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, NULL) succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, NULL) returns NULL");
rwops = SDL_RWFromFile(NULL, "ab+");
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"ab+\") succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"ab+\") returns NULL");
rwops = SDL_RWFromFile(NULL, "sldfkjsldkfj");
SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"sldfkjsldkfj\") succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"sldfkjsldkfj\") returns NULL");
rwops = SDL_RWFromFile("something", "");
SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", \"\") succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", \"\") returns NULL");
rwops = SDL_RWFromFile("something", NULL);
SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", NULL) succeeded");
SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", NULL) returns NULL");
return TEST_COMPLETED;
}
/**
* @brief Tests opening from memory.
*
* \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
Jan 21, 2013
Jan 21, 2013
181
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
*/
int
rwops_testMem (void)
{
char mem[sizeof(RWopsHelloWorldTestString)];
SDL_RWops *rw;
/* Clear buffer */
SDL_zero(mem);
/* Open */
rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);
SDLTest_AssertPass("Call to SDL_RWFromMem() succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
/* Run generic tests */
_testGenericRWopsValidations(rw, 1);
/* Close */
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
return TEST_COMPLETED;
}
/**
* @brief Tests opening from memory.
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromConstMem
Jan 21, 2013
Jan 21, 2013
216
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
*/
int
rwops_testConstMem (void)
{
SDL_RWops *rw;
/* Open handle */
rw = SDL_RWFromConstMem( RWopsHelloWorldCompString, sizeof(RWopsHelloWorldCompString)-1 );
SDLTest_AssertPass("Call to SDL_RWFromConstMem() succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");
/* Bail out if NULL */
if (rw == NULL) return TEST_ABORTED;
/* Run generic tests */
_testGenericRWopsValidations( rw, 0 );
/* Close handle */
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
return TEST_COMPLETED;
}
/**
* @brief Tests reading from file.
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
Jan 21, 2013
Jan 21, 2013
247
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
*/
int
rwops_testFileRead(void)
{
SDL_RWops *rw;
/* Read test. */
rw = SDL_RWFromFile(RWopsReadTestFilename, "r");
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"r\") succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in read mode does not return NULL");
// Bail out if NULL
if (rw == NULL) return TEST_ABORTED;
/* Run generic tests */
_testGenericRWopsValidations( rw, 0 );
/* Close handle */
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
return TEST_COMPLETED;
}
/**
Jan 21, 2013
Jan 21, 2013
273
* @brief Tests writing from file.
274
275
276
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
Jan 21, 2013
Jan 21, 2013
277
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
*/
int
rwops_testFileWrite(void)
{
SDL_RWops *rw;
/* Write test. */
rw = SDL_RWFromFile(RWopsWriteTestFilename, "w+");
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\") succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
// Bail out if NULL
if (rw == NULL) return TEST_ABORTED;
/* Run generic tests */
_testGenericRWopsValidations( rw, 1 );
/* Close handle */
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
return TEST_COMPLETED;
}
/**
* @brief Tests reading from file handle
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
Jan 21, 2013
Jan 21, 2013
308
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
*
*/
int
rwops_testFPRead(void)
{
FILE *fp;
SDL_RWops *rw;
/* Run read tests. */
fp = fopen(RWopsReadTestFilename, "r");
SDLTest_AssertCheck(fp != NULL, "Verify handle from opening file '%s' in read mode is not NULL", RWopsReadTestFilename);
/* Bail out if NULL */
if (fp == NULL) return TEST_ABORTED;
/* Open */
Dec 30, 2012
Dec 30, 2012
325
rw = SDL_RWFromFP( fp, SDL_TRUE );
326
327
328
329
SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in read mode does not return NULL");
/* Bail out if NULL */
Dec 31, 2012
Dec 31, 2012
330
331
332
333
if (rw == NULL) {
fclose(fp);
return TEST_ABORTED;
}
334
335
336
337
/* Run generic tests */
_testGenericRWopsValidations( rw, 0 );
Jan 14, 2013
Jan 14, 2013
338
/* Close handle - does fclose() */
339
340
341
342
343
344
345
346
347
348
349
350
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
return TEST_COMPLETED;
}
/**
* @brief Tests writing to file handle
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFP
Jan 21, 2013
Jan 21, 2013
351
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
*
*/
int
rwops_testFPWrite(void)
{
FILE *fp;
SDL_RWops *rw;
/* Run write tests. */
fp = fopen(RWopsWriteTestFilename, "w+");
SDLTest_AssertCheck(fp != NULL, "Verify handle from opening file '%s' in write mode is not NULL", RWopsWriteTestFilename);
/* Bail out if NULL */
if (fp == NULL) return TEST_ABORTED;
/* Open */
Dec 30, 2012
Dec 30, 2012
368
rw = SDL_RWFromFP( fp, SDL_TRUE );
369
370
371
372
SDLTest_AssertPass("Call to SDL_RWFromFP() succeeded");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFP in write mode does not return NULL");
/* Bail out if NULL */
Dec 31, 2012
Dec 31, 2012
373
374
375
376
if (rw == NULL) {
fclose(fp);
return TEST_ABORTED;
}
377
378
379
380
/* Run generic tests */
_testGenericRWopsValidations( rw, 1 );
Jan 14, 2013
Jan 14, 2013
381
/* Close handle - does fclose() */
382
383
384
385
386
387
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
return TEST_COMPLETED;
}
Dec 31, 2012
Dec 31, 2012
388
389
390
391
/**
* @brief Tests alloc and free RW context.
*
* \sa http://wiki.libsdl.org/moin.cgi/SDL_AllocRW
Jan 21, 2013
Jan 21, 2013
392
* \sa http://wiki.libsdl.org/moin.cgi/SDL_FreeRW
Dec 31, 2012
Dec 31, 2012
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
*/
int
rwops_testAllocFree (void)
{
/* Allocate context */
SDL_RWops *rw = SDL_AllocRW();
SDLTest_AssertPass("Call to SDL_AllocRW() succeeded");
SDLTest_AssertCheck(rw != NULL, "Validate result from SDL_AllocRW() is not NULL");
if (rw==NULL) return TEST_ABORTED;
/* Free context again */
SDL_FreeRW(rw);
SDLTest_AssertPass("Call to SDL_FreeRW() succeeded");
return TEST_COMPLETED;
}
Jan 21, 2013
Jan 21, 2013
410
411
412
413
414
415
416
417
418
419
420
421
422
/**
* @brief Tests writing and reading from file using endian aware functions.
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
* http://wiki.libsdl.org/moin.cgi/SDL_RWClose
* http://wiki.libsdl.org/moin.cgi/SDL_ReadBE16
* http://wiki.libsdl.org/moin.cgi/SDL_WriteBE16
*/
int
rwops_testFileWriteReadEndian(void)
{
SDL_RWops *rw;
Jan 23, 2013
Jan 23, 2013
423
Sint64 result;
Jan 21, 2013
Jan 21, 2013
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
int mode;
size_t objectsWritten;
Uint16 BE16value;
Uint32 BE32value;
Uint64 BE64value;
Uint16 LE16value;
Uint32 LE32value;
Uint64 LE64value;
Uint16 BE16test;
Uint32 BE32test;
Uint64 BE64test;
Uint16 LE16test;
Uint32 LE32test;
Uint64 LE64test;
for (mode = 0; mode < 3; mode++) {
/* Create test data */
switch (mode) {
case 0:
SDLTest_Log("All 0 values");
BE16value = 0;
BE32value = 0;
BE64value = 0;
LE16value = 0;
LE32value = 0;
LE64value = 0;
break;
case 1:
SDLTest_Log("All 1 values");
BE16value = 1;
BE32value = 1;
BE64value = 1;
LE16value = 1;
LE32value = 1;
LE64value = 1;
break;
case 2:
SDLTest_Log("Random values");
BE16value = SDLTest_RandomUint16();
BE32value = SDLTest_RandomUint32();
BE64value = SDLTest_RandomUint64();
LE16value = SDLTest_RandomUint16();
LE32value = SDLTest_RandomUint32();
LE64value = SDLTest_RandomUint64();
break;
}
/* Write test. */
rw = SDL_RWFromFile(RWopsWriteTestFilename, "w+");
SDLTest_AssertPass("Call to SDL_RWFromFile(..,\"w+\")");
SDLTest_AssertCheck(rw != NULL, "Verify opening file with SDL_RWFromFile in write mode does not return NULL");
// Bail out if NULL
if (rw == NULL) return TEST_ABORTED;
/* Write test data */
objectsWritten = SDL_WriteBE16(rw, BE16value);
SDLTest_AssertPass("Call to SDL_WriteBE16");
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten);
objectsWritten = SDL_WriteBE32(rw, BE32value);
SDLTest_AssertPass("Call to SDL_WriteBE32");
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten);
objectsWritten = SDL_WriteBE64(rw, BE64value);
SDLTest_AssertPass("Call to SDL_WriteBE64");
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten);
objectsWritten = SDL_WriteLE16(rw, LE16value);
SDLTest_AssertPass("Call to SDL_WriteLE16");
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten);
objectsWritten = SDL_WriteLE32(rw, LE32value);
SDLTest_AssertPass("Call to SDL_WriteLE32");
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten);
objectsWritten = SDL_WriteLE64(rw, LE64value);
SDLTest_AssertPass("Call to SDL_WriteLE64");
SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten);
/* Test seek to start */
result = SDL_RWseek( rw, 0, RW_SEEK_SET );
SDLTest_AssertPass("Call to SDL_RWseek succeeded");
SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %i", result);
/* Read test data */
BE16test = SDL_ReadBE16(rw);
SDLTest_AssertPass("Call to SDL_ReadBE16");
SDLTest_AssertCheck(BE16test == BE16value, "Validate return value from SDL_ReadBE16, expected: %hu, got: %hu", BE16value, BE16test);
BE32test = SDL_ReadBE32(rw);
SDLTest_AssertPass("Call to SDL_ReadBE32");
SDLTest_AssertCheck(BE32test == BE32value, "Validate return value from SDL_ReadBE32, expected: %u, got: %u", BE32value, BE32test);
BE64test = SDL_ReadBE64(rw);
SDLTest_AssertPass("Call to SDL_ReadBE64");
SDLTest_AssertCheck(BE64test == BE64value, "Validate return value from SDL_ReadBE64, expected: %llu, got: %llu", BE64value, BE64test);
LE16test = SDL_ReadLE16(rw);
SDLTest_AssertPass("Call to SDL_ReadLE16");
SDLTest_AssertCheck(LE16test == LE16value, "Validate return value from SDL_ReadLE16, expected: %hu, got: %hu", LE16value, LE16test);
LE32test = SDL_ReadLE32(rw);
SDLTest_AssertPass("Call to SDL_ReadLE32");
SDLTest_AssertCheck(LE32test == LE32value, "Validate return value from SDL_ReadLE32, expected: %u, got: %u", LE32value, LE32test);
LE64test = SDL_ReadLE64(rw);
SDLTest_AssertPass("Call to SDL_ReadLE64");
SDLTest_AssertCheck(LE64test == LE64value, "Validate return value from SDL_ReadLE64, expected: %llu, got: %llu", LE64value, LE64test);
/* Close handle */
SDL_RWclose(rw);
SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
}
return TEST_COMPLETED;
}
Dec 31, 2012
Dec 31, 2012
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
/* ================= Test References ================== */
/* RWops test cases */
static const SDLTest_TestCaseReference rwopsTest1 =
{ (SDLTest_TestCaseFp)rwops_testParamNegative, "rwops_testParamNegative", "Negative test for SDL_RWFromFile parameters", TEST_ENABLED };
static const SDLTest_TestCaseReference rwopsTest2 =
{ (SDLTest_TestCaseFp)rwops_testMem, "rwops_testMem", "Tests opening from memory", TEST_ENABLED };
static const SDLTest_TestCaseReference rwopsTest3 =
{ (SDLTest_TestCaseFp)rwops_testConstMem, "rwops_testConstMem", "Tests opening from (const) memory", TEST_ENABLED };
static const SDLTest_TestCaseReference rwopsTest4 =
{ (SDLTest_TestCaseFp)rwops_testFileRead, "rwops_testFileRead", "Tests reading from a file", TEST_ENABLED };
static const SDLTest_TestCaseReference rwopsTest5 =
{ (SDLTest_TestCaseFp)rwops_testFileWrite, "rwops_testFileWrite", "Test writing to a file", TEST_ENABLED };
static const SDLTest_TestCaseReference rwopsTest6 =
{ (SDLTest_TestCaseFp)rwops_testFPRead, "rwops_testFPRead", "Test reading from file pointer", TEST_ENABLED };
static const SDLTest_TestCaseReference rwopsTest7 =
{ (SDLTest_TestCaseFp)rwops_testFPWrite, "rwops_testFPWrite", "Test writing to file pointer", TEST_ENABLED };
Dec 31, 2012
Dec 31, 2012
559
560
561
static const SDLTest_TestCaseReference rwopsTest8 =
{ (SDLTest_TestCaseFp)rwops_testAllocFree, "rwops_testAllocFree", "Test alloc and free of RW context", TEST_ENABLED };
Jan 21, 2013
Jan 21, 2013
562
563
564
static const SDLTest_TestCaseReference rwopsTest9 =
{ (SDLTest_TestCaseFp)rwops_testFileWriteReadEndian, "rwops_testFileWriteReadEndian", "Test writing and reading via the Endian aware functions", TEST_ENABLED };
565
566
/* Sequence of RWops test cases */
static const SDLTest_TestCaseReference *rwopsTests[] = {
Jan 21, 2013
Jan 21, 2013
567
568
&rwopsTest1, &rwopsTest2, &rwopsTest3, &rwopsTest4, &rwopsTest5, &rwopsTest6,
&rwopsTest7, &rwopsTest8, &rwopsTest9, NULL
569
570
571
572
573
574
575
576
577
};
/* RWops test suite (global) */
SDLTest_TestSuiteReference rwopsTestSuite = {
"RWops",
RWopsSetUp,
rwopsTests,
RWopsTearDown
};