author | Andreas Schiffler <aschiffler@ferzkopp.net> |
Sun, 16 Dec 2012 21:59:29 -0800 | |
changeset 6760 | 04dcce3081e6 |
permissions | -rw-r--r-- |
6760
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
1 |
/** |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
2 |
* New/updated tests: aschiffler at ferzkopp dot net |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
3 |
*/ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
4 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
5 |
#include <stdio.h> |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
6 |
#include <string.h> |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
7 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
8 |
#include "SDL.h" |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
9 |
#include "SDL_test.h" |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
10 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
11 |
/* ================= Test Case Implementation ================== */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
12 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
13 |
/* Test case functions */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
14 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
15 |
/** |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
16 |
* \brief Check call to SDL_HasClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
17 |
* |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
18 |
* \sa |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
19 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
20 |
*/ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
21 |
int |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
22 |
clipboard_testHasClipboardText(void *arg) |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
23 |
{ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
24 |
SDL_bool result; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
25 |
result = SDL_HasClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
26 |
SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
27 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
28 |
return TEST_COMPLETED; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
29 |
} |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
30 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
31 |
/** |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
32 |
* \brief Check call to SDL_GetClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
33 |
* |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
34 |
* \sa |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
35 |
* http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
36 |
*/ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
37 |
int |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
38 |
clipboard_testGetClipboardText(void *arg) |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
39 |
{ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
40 |
char *charResult; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
41 |
charResult = SDL_GetClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
42 |
SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
43 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
44 |
if (charResult) SDL_free(charResult); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
45 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
46 |
return TEST_COMPLETED; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
47 |
} |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
48 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
49 |
/** |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
50 |
* \brief Check call to SDL_SetClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
51 |
* \sa |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
52 |
* http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
53 |
*/ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
54 |
int |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
55 |
clipboard_testSetClipboardText(void *arg) |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
56 |
{ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
57 |
char *textRef = SDLTest_RandomAsciiString(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
58 |
char *text = SDL_strdup(textRef); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
59 |
int result; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
60 |
result = SDL_SetClipboardText((const char *)text); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
61 |
SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
62 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
63 |
result == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
64 |
"Validate SDL_SetClipboardText result, expected 0, got %i", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
65 |
result); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
66 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
67 |
SDL_strcmp(textRef, text) == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
68 |
"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
69 |
textRef, text); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
70 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
71 |
/* Cleanup */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
72 |
if (textRef) SDL_free(textRef); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
73 |
if (text) SDL_free(text); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
74 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
75 |
return TEST_COMPLETED; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
76 |
} |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
77 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
78 |
/** |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
79 |
* \brief End-to-end test of SDL_xyzClipboardText functions |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
80 |
* \sa |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
81 |
* http://wiki.libsdl.org/moin.cgi/SDL_HasClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
82 |
* http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
83 |
* http://wiki.libsdl.org/moin.cgi/SDL_SetClipboardText |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
84 |
*/ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
85 |
int |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
86 |
clipboard_testClipboardTextFunctions(void *arg) |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
87 |
{ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
88 |
char *textRef = SDLTest_RandomAsciiString(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
89 |
char *text = SDL_strdup(textRef); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
90 |
SDL_bool boolResult; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
91 |
int intResult; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
92 |
char *charResult; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
93 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
94 |
/* Clear clipboard text state */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
95 |
boolResult = SDL_HasClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
96 |
SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
97 |
if (boolResult == SDL_TRUE) { |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
98 |
intResult = SDL_SetClipboardText((const char *)NULL); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
99 |
SDLTest_AssertPass("Call to DL_SetClipboardText(NULL) succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
100 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
101 |
intResult == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
102 |
"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
103 |
intResult); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
104 |
charResult = SDL_GetClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
105 |
SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
106 |
boolResult = SDL_HasClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
107 |
SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
108 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
109 |
boolResult == SDL_FALSE, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
110 |
"Verify SDL_HasClipboardText returned SDL_FALSE, got %s", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
111 |
(boolResult) ? "SDL_TRUE" : "SDL_FALSE"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
112 |
} |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
113 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
114 |
/* Empty clipboard */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
115 |
charResult = SDL_GetClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
116 |
SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
117 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
118 |
charResult != NULL, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
119 |
"Verify SDL_GetClipboardText did not return NULL"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
120 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
121 |
strlen(charResult) == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
122 |
"Verify SDL_GetClipboardText returned string with length 0, got length %i", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
123 |
strlen(charResult)); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
124 |
intResult = SDL_SetClipboardText((const char *)text); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
125 |
SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
126 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
127 |
intResult == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
128 |
"Verify result from SDL_SetClipboardText(NULL), expected 0, got %i", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
129 |
intResult); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
130 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
131 |
strcmp(textRef, text) == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
132 |
"Verify SDL_SetClipboardText did not modify input string, expected '%s', got '%s'", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
133 |
textRef, text); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
134 |
boolResult = SDL_HasClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
135 |
SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
136 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
137 |
boolResult == SDL_TRUE, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
138 |
"Verify SDL_HasClipboardText returned SDL_TRUE, got %s", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
139 |
(boolResult) ? "SDL_TRUE" : "SDL_FALSE"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
140 |
charResult = SDL_GetClipboardText(); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
141 |
SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded"); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
142 |
SDLTest_AssertCheck( |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
143 |
strcmp(textRef, charResult) == 0, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
144 |
"Verify SDL_GetClipboardText returned correct string, expected '%s', got '%s'", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
145 |
textRef, charResult); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
146 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
147 |
/* Cleanup */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
148 |
if (textRef) SDL_free(textRef); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
149 |
if (text) SDL_free(text); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
150 |
if (charResult) SDL_free(charResult); |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
151 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
152 |
return TEST_COMPLETED; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
153 |
} |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
154 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
155 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
156 |
/* ================= Test References ================== */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
157 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
158 |
/* Clipboard test cases */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
159 |
static const SDLTest_TestCaseReference clipboardTest1 = |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
160 |
{ (SDLTest_TestCaseFp)clipboard_testHasClipboardText, "clipboard_testHasClipboardText", "Check call to SDL_HasClipboardText", TEST_ENABLED }; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
161 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
162 |
static const SDLTest_TestCaseReference clipboardTest2 = |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
163 |
{ (SDLTest_TestCaseFp)clipboard_testGetClipboardText, "clipboard_testGetClipboardText", "Check call to SDL_GetClipboardText", TEST_ENABLED }; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
164 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
165 |
static const SDLTest_TestCaseReference clipboardTest3 = |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
166 |
{ (SDLTest_TestCaseFp)clipboard_testSetClipboardText, "clipboard_testSetClipboardText", "Check call to SDL_SetClipboardText", TEST_ENABLED }; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
167 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
168 |
static const SDLTest_TestCaseReference clipboardTest4 = |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
169 |
{ (SDLTest_TestCaseFp)clipboard_testClipboardTextFunctions, "clipboard_testClipboardTextFunctions", "End-to-end test of SDL_xyzClipboardText functions", TEST_ENABLED }; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
170 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
171 |
/* Sequence of Clipboard test cases */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
172 |
static const SDLTest_TestCaseReference *clipboardTests[] = { |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
173 |
&clipboardTest1, &clipboardTest2, &clipboardTest3, &clipboardTest4, NULL |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
174 |
}; |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
175 |
|
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
176 |
/* Clipboard test suite (global) */ |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
177 |
SDLTest_TestSuiteReference clipboardTestSuite = { |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
178 |
"Clipboard", |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
179 |
NULL, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
180 |
clipboardTests, |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
181 |
NULL |
04dcce3081e6
Port clipboard and rwops test suites from GSOC code; minor updates to harness and fuzzer in test lib
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
diff
changeset
|
182 |
}; |