author | Philipp Wiesemann <philipp.wiesemann@arcor.de> |
Tue, 28 Jun 2016 21:14:11 +0200 | |
changeset 10188 | 9cf58ba2b2ad |
parent 8646 | 0a20fff4de3c |
child 10189 | 4844b48eb17b |
permissions | -rw-r--r-- |
7216
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 |
/** |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 |
* Standard C library routine test suite |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 |
*/ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 |
#include <stdio.h> |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 |
#include "SDL.h" |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 |
#include "SDL_test.h" |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 |
/* Test case functions */ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 |
/** |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
* @brief Call to SDL_strlcpy |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 |
*/ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 |
#undef SDL_strlcpy |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 |
int |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
stdlib_strlcpy(void *arg) |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 |
{ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 |
size_t result; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 |
char text[1024]; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
const char *expected; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 |
result = SDL_strlcpy(text, "foo", sizeof(text)); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 |
expected = "foo"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
SDLTest_AssertPass("Call to SDL_strlcpy(\"foo\")"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
result = SDL_strlcpy(text, "foo", 2); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
expected = "f"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 |
SDLTest_AssertPass("Call to SDL_strlcpy(\"foo\") with buffer size 2"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
SDLTest_AssertCheck(result == 3, "Check result value, expected: 3, got: %d", result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 |
return TEST_COMPLETED; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 |
} |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
/** |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 |
* @brief Call to SDL_snprintf |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 |
*/ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
#undef SDL_snprintf |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 |
int |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 |
stdlib_snprintf(void *arg) |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 |
{ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 |
int result; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 |
char text[1024]; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
const char *expected; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 |
result = SDL_snprintf(text, sizeof(text), "%s", "foo"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
expected = "foo"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%s\", \"foo\")"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 |
result = SDL_snprintf(text, 2, "%s", "foo"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 |
expected = "f"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%s\", \"foo\") with buffer size 2"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 |
SDLTest_AssertCheck(result == 3, "Check result value, expected: 3, got: %d", result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 |
result = SDL_snprintf(NULL, 0, "%s", "foo"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 |
SDLTest_AssertCheck(result == 3, "Check result value, expected: 3, got: %d", result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 |
result = SDL_snprintf(text, sizeof(text), "%f", 1.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 |
expected = "1.000000"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%f\", 1.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 |
result = SDL_snprintf(text, sizeof(text), "%.f", 1.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 |
expected = "1"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%.f\", 1.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
result = SDL_snprintf(text, sizeof(text), "%#.f", 1.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
expected = "1."; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%#.f\", 1.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 |
result = SDL_snprintf(text, sizeof(text), "%f", 1.0 + 1.0 / 3.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 |
expected = "1.333333"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%f\", 1.0 + 1.0 / 3.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 |
result = SDL_snprintf(text, sizeof(text), "%+f", 1.0 + 1.0 / 3.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 |
expected = "+1.333333"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%+f\", 1.0 + 1.0 / 3.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 |
result = SDL_snprintf(text, sizeof(text), "%.2f", 1.0 + 1.0 / 3.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 |
expected = "1.33"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%.2f\", 1.0 + 1.0 / 3.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 |
result = SDL_snprintf(text, sizeof(text), "%6.2f", 1.0 + 1.0 / 3.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 |
expected = " 1.33"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%6.2f\", 1.0 + 1.0 / 3.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 |
result = SDL_snprintf(text, sizeof(text), "%06.2f", 1.0 + 1.0 / 3.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 |
expected = "001.33"; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%06.2f\", 1.0 + 1.0 / 3.0)"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 |
SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", SDL_strlen(text), result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 |
result = SDL_snprintf(text, 5, "%06.2f", 1.0 + 1.0 / 3.0); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 |
expected = "001."; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
SDLTest_AssertPass("Call to SDL_snprintf(\"%%06.2f\", 1.0 + 1.0 / 3.0) with buffer size 5"); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 |
SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 |
SDLTest_AssertCheck(result == 6, "Check result value, expected: 6, got: %d", result); |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 |
return TEST_COMPLETED; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 |
} |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 |
|
8645
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
122 |
/** |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
123 |
* @brief Call to SDL_getenv and SDL_setenv |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
124 |
*/ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
125 |
int |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
126 |
stdlib_getsetenv(void *arg) |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
127 |
{ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
128 |
const int nameLen = 16; |
8646
0a20fff4de3c
Fix visualstudio build break introduced by changeset 8645
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
8645
diff
changeset
|
129 |
char name[17]; |
8645
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
130 |
int counter; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
131 |
int result; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
132 |
char * value1; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
133 |
char * value2; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
134 |
char * expected; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
135 |
int overwrite; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
136 |
char * text; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
137 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
138 |
/* Create a random name. This tests SDL_getenv, since we need to */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
139 |
/* make sure the variable is not set yet (it shouldn't). */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
140 |
do { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
141 |
for(counter = 0; counter < nameLen; counter++) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
142 |
name[counter] = (char)SDLTest_RandomIntegerInRange(65, 90); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
143 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
144 |
name[nameLen] = '\0'; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
145 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
146 |
text = SDL_getenv(name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
147 |
SDLTest_AssertPass("Call to SDL_getenv('%s')", name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
148 |
if (text != NULL) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
149 |
SDLTest_Log("Expected: NULL, Got: '%s' (%i)", text, SDL_strlen(text)); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
150 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
151 |
} while (text != NULL); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
152 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
153 |
/* Create random values to set */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
154 |
value1 = SDLTest_RandomAsciiStringOfSize(10); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
155 |
value2 = SDLTest_RandomAsciiStringOfSize(10); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
156 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
157 |
/* Set value 1 without overwrite */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
158 |
overwrite = 0; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
159 |
expected = value1; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
160 |
result = SDL_setenv(name, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
161 |
SDLTest_AssertPass("Call to SDL_setenv('%s','%s', %i)", name, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
162 |
SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
163 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
164 |
/* Check value */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
165 |
text = SDL_getenv(name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
166 |
SDLTest_AssertPass("Call to SDL_getenv('%s')", name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
167 |
SDLTest_AssertCheck(text != NULL, "Verify returned text is not NULL"); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
168 |
if (text != NULL) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
169 |
SDLTest_AssertCheck( |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
170 |
SDL_strcmp(text, expected) == 0, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
171 |
"Verify returned text, expected: %s, got: %s", |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
172 |
expected, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
173 |
text); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
174 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
175 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
176 |
/* Set value 2 with overwrite */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
177 |
overwrite = 1; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
178 |
expected = value2; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
179 |
result = SDL_setenv(name, value2, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
180 |
SDLTest_AssertPass("Call to SDL_setenv('%s','%s', %i)", name, value2, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
181 |
SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
182 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
183 |
/* Check value */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
184 |
text = SDL_getenv(name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
185 |
SDLTest_AssertPass("Call to SDL_getenv('%s')", name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
186 |
SDLTest_AssertCheck(text != NULL, "Verify returned text is not NULL"); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
187 |
if (text != NULL) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
188 |
SDLTest_AssertCheck( |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
189 |
SDL_strcmp(text, expected) == 0, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
190 |
"Verify returned text, expected: %s, got: %s", |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
191 |
expected, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
192 |
text); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
193 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
194 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
195 |
/* Set value 1 without overwrite */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
196 |
overwrite = 0; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
197 |
expected = value2; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
198 |
result = SDL_setenv(name, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
199 |
SDLTest_AssertPass("Call to SDL_setenv('%s','%s', %i)", name, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
200 |
SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
201 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
202 |
/* Check value */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
203 |
text = SDL_getenv(name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
204 |
SDLTest_AssertPass("Call to SDL_getenv('%s')", name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
205 |
SDLTest_AssertCheck(text != NULL, "Verify returned text is not NULL"); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
206 |
if (text != NULL) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
207 |
SDLTest_AssertCheck( |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
208 |
SDL_strcmp(text, expected) == 0, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
209 |
"Verify returned text, expected: %s, got: %s", |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
210 |
expected, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
211 |
text); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
212 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
213 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
214 |
/* Set value 1 without overwrite */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
215 |
overwrite = 1; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
216 |
expected = value1; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
217 |
result = SDL_setenv(name, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
218 |
SDLTest_AssertPass("Call to SDL_setenv('%s','%s', %i)", name, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
219 |
SDLTest_AssertCheck(result == 0, "Check result, expected: 0, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
220 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
221 |
/* Check value */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
222 |
text = SDL_getenv(name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
223 |
SDLTest_AssertPass("Call to SDL_getenv('%s')", name); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
224 |
SDLTest_AssertCheck(text != NULL, "Verify returned text is not NULL"); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
225 |
if (text != NULL) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
226 |
SDLTest_AssertCheck( |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
227 |
SDL_strcmp(text, expected) == 0, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
228 |
"Verify returned text, expected: %s, got: %s", |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
229 |
expected, |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
230 |
text); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
231 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
232 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
233 |
/* Negative cases */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
234 |
for (overwrite=0; overwrite <= 1; overwrite++) { |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
235 |
result = SDL_setenv(NULL, value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
236 |
SDLTest_AssertPass("Call to SDL_setenv(NULL,'%s', %i)", value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
237 |
SDLTest_AssertCheck(result == -1, "Check result, expected: -1, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
238 |
result = SDL_setenv("", value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
239 |
SDLTest_AssertPass("Call to SDL_setenv('','%s', %i)", value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
240 |
SDLTest_AssertCheck(result == -1, "Check result, expected: -1, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
241 |
result = SDL_setenv("=", value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
242 |
SDLTest_AssertPass("Call to SDL_setenv('=','%s', %i)", value1, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
243 |
SDLTest_AssertCheck(result == -1, "Check result, expected: -1, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
244 |
result = SDL_setenv(name, NULL, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
245 |
SDLTest_AssertPass("Call to SDL_setenv('%s', NULL, %i)", name, overwrite); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
246 |
SDLTest_AssertCheck(result == -1, "Check result, expected: -1, got: %i", result); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
247 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
248 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
249 |
/* Clean up */ |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
250 |
SDL_free(value1); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
251 |
SDL_free(value2); |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
252 |
|
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
253 |
return TEST_COMPLETED; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
254 |
} |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
255 |
|
10188
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
256 |
/** |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
257 |
* @brief Call to SDL_sscanf |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
258 |
*/ |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
259 |
#undef SDL_sscanf |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
260 |
int |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
261 |
stdlib_sscanf(void *arg) |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
262 |
{ |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
263 |
int output; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
264 |
int result; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
265 |
int expected_output; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
266 |
int expected_result; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
267 |
|
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
268 |
expected_output = output = 123; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
269 |
expected_result = -1; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
270 |
result = SDL_sscanf("", "%i", &output); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
271 |
SDLTest_AssertPass("Call to SDL_sscanf(\"\", \"%%i\", &output)"); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
272 |
SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
273 |
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
274 |
|
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
275 |
expected_output = output = 123; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
276 |
expected_result = 0; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
277 |
result = SDL_sscanf("a", "%i", &output); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
278 |
SDLTest_AssertPass("Call to SDL_sscanf(\"a\", \"%%i\", &output)"); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
279 |
SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
280 |
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
281 |
|
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
282 |
output = 123; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
283 |
expected_output = 2; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
284 |
expected_result = 1; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
285 |
result = SDL_sscanf("2", "%i", &output); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
286 |
SDLTest_AssertPass("Call to SDL_sscanf(\"2\", \"%%i\", &output)"); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
287 |
SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
288 |
SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result); |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
289 |
|
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
290 |
return TEST_COMPLETED; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
291 |
} |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
292 |
|
7216
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 |
/* ================= Test References ================== */ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 |
/* Standard C routine test cases */ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 |
static const SDLTest_TestCaseReference stdlibTest1 = |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 |
{ (SDLTest_TestCaseFp)stdlib_strlcpy, "stdlib_strlcpy", "Call to SDL_strlcpy", TEST_ENABLED }; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 |
static const SDLTest_TestCaseReference stdlibTest2 = |
7219
c577dfb69153
Fixed test description in test suite for standard library.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
7216
diff
changeset
|
300 |
{ (SDLTest_TestCaseFp)stdlib_snprintf, "stdlib_snprintf", "Call to SDL_snprintf", TEST_ENABLED }; |
7216
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 |
|
8645
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
302 |
static const SDLTest_TestCaseReference stdlibTest3 = |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
303 |
{ (SDLTest_TestCaseFp)stdlib_getsetenv, "stdlib_getsetenv", "Call to SDL_getenv and SDL_setenv", TEST_ENABLED }; |
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
304 |
|
10188
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
305 |
static const SDLTest_TestCaseReference stdlibTest4 = |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
306 |
{ (SDLTest_TestCaseFp)stdlib_sscanf, "stdlib_sscanf", "Call to SDL_sscanf", TEST_ENABLED }; |
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
307 |
|
7216
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 |
/* Sequence of Standard C routine test cases */ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 |
static const SDLTest_TestCaseReference *stdlibTests[] = { |
10188
9cf58ba2b2ad
Added a simple test case for SDL_sscanf() to tests.
Philipp Wiesemann <philipp.wiesemann@arcor.de>
parents:
8646
diff
changeset
|
310 |
&stdlibTest1, &stdlibTest2, &stdlibTest3, &stdlibTest4, NULL |
7216
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 |
}; |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 |
|
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 |
/* Timer test suite (global) */ |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 |
SDLTest_TestSuiteReference stdlibTestSuite = { |
8645
d69fdbefeecf
Add input validation to SDL_getenv/SDL_setenv; update Stdlib testsuite; add Hints testsuite
Andreas Schiffler <aschiffler@ferzkopp.net>
parents:
7219
diff
changeset
|
315 |
"Stdlib", |
7216
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 |
NULL, |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 |
stdlibTests, |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 |
NULL |
3586fc0ba156
Added the beginning of automated tests for the standard C library routines.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 |
}; |