Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
19 #include "shared/shared.h"
20 #include "common/bsp.h"
21 #include "common/cmd.h"
22 #include "common/common.h"
23 #include "common/files.h"
24 #include "common/tests.h"
25 #include "refresh/refresh.h"
26 #include "system/system.h"
45 Com_Printf(
"Usage: %s <seconds>\n",
Cmd_Argv(0));
55 msec = seconds * 1000;
70 memset(buf1, 0xcc, 16);
76 memset(buf2, 0xcc, 16);
83 memset(buf3, 0xcc, 16);
89 *(uint32_t *)1024 = 0x123456;
97 char buf[MAXPRINTMSG * 2];
101 for (i = 0; i <
sizeof(buf) - 1; i++)
102 buf[i] =
'a' + i % (
'z' -
'a' + 1);
106 for (i = 0; i < 64; i++)
107 buf[rand() % (
sizeof(buf) - 1)] =
' ';
114 for (i = 0; i < count; i++)
115 Com_Printf(
"%s", buf);
123 int i, count, errors;
128 list =
FS_ListFiles(
"maps",
".bsp", FS_SEARCH_SAVEPATH, &count);
130 Com_Printf(
"No maps found\n");
137 for (i = 0; i < count; i++) {
146 Com_DPrintf(
"%s: success\n", name);
152 Com_Printf(
"%d msec, %d failures, %d maps tested\n",
153 end - start, errors, count);
168 {
"foo*bar",
"foobar", 1 },
169 {
"foo*bar*baz",
"foobaz", 0 },
170 {
"bar*",
"bar", 1 },
171 {
"bar*",
"barfoo", 1 },
172 {
"???*",
"barfoo", 1 },
173 {
"???\\*",
"bar*", 1 },
174 {
"???\\*",
"bar*bar", 0 },
175 {
"???\\*",
"bar?", 0 },
176 {
"*\\?",
"bar?", 1 },
179 {
"foo*bar\\*baz",
"foo*abcbar*baz", 1 },
180 {
"\\a\\b\\c",
"abc", 1 },
197 "Com_WildCmp( \"%s\", \"%s\" ) == %d, expected %d\n",
203 Com_Printf(
"%d failures, %d patterns tested\n",
215 {
"foo///",
"foo/", },
219 {
"foo\\bar",
"foo/bar" },
221 {
"foo.bar.baz/..",
"" },
222 {
"foo/../bar",
"bar" },
223 {
"foo/.././bar",
"bar" },
224 {
"foo/./../bar",
"bar" },
225 {
"foo/./bar",
"foo/bar" },
226 {
"foo//bar",
"foo/bar" },
227 {
"foo///.////bar",
"foo/bar" },
228 {
"foo/./././bar",
"foo/bar" },
231 {
"../../../foo",
"foo" },
232 {
"./../../foo",
"foo" },
233 {
"../bar/../foo",
"foo" },
234 {
"foo/bar/..",
"foo" },
235 {
"foo/bar/../",
"foo/" },
236 {
"foo/bar/.",
"foo/bar" },
237 {
"foo/bar/./",
"foo/bar/" },
247 {
"../../../../",
"" },
248 {
"../foo..bar/",
"foo..bar/" },
249 {
"......./",
"......./" },
251 {
"foo/bar/baz/abc/../def",
"foo/bar/baz/def" },
252 {
"foo/bar/baz/abc/../../def",
"foo/bar/def" },
253 {
"foo/bar/../baz/abc/../def",
"foo/baz/def" },
254 {
"foo/bar/../../baz/abc/../../def",
"def" },
255 {
"foo/bar/../../../../baz/abc/../../zzz/../def/ghi",
"def/ghi" },
263 char buffer[MAX_QPATH];
266 for (pass = 0; pass < 2; pass++) {
274 strcpy(buffer, n->
in);
277 if (strcmp(n->
out, buffer)) {
279 "FS_NormalizePath( \"%s\" ) == \"%s\", expected \"%s\" (pass %d)\n",
280 n->
in, buffer, n->
out, pass);
288 Com_Printf(
"%d failures, %d paths tested (%d passes)\n",
302 {
"\\\\\\key\\value", 1 },
304 {
"\\key\\\\key\\value", 1 },
305 {
"\\key\\value", 1 },
306 {
"\\key\\value\\", 0 },
308 {
"key\\value\\", 0 },
313 {
"\\ke;y\\value", 0 },
314 {
"\\ke\"y\\value", 0 },
315 {
"\\key\\va;lue", 0 },
316 {
"\\key\\va\"lue", 0 },
317 {
"\\ke\x81y\\value", 0 },
318 {
"\\key\\val\x82ue", 0 },
319 {
"\\ke\ny\\value", 0 },
320 {
"\\key\\val\nue", 0 },
321 {
"\\abcdabcdabcdabcd"
330 "abcdabcdabcdabcd", 0 },
343 {
"\\key\\value",
"key",
"" },
344 {
"key\\value",
"key",
"" },
345 {
"\\key1\\value1\\key2\\value2",
"key1",
"\\key2\\value2" },
346 {
"\\key1\\value1\\key2\\value2",
"key2",
"\\key1\\value1" },
347 {
"\\key1\\value1\\key2\\value2\\key1\\value3",
"key1",
"\\key2\\value2" },
348 {
"\\key\\value",
"",
"\\key\\value" },
349 {
"\\\\value",
"",
"" },
363 {
"",
"",
"", 1,
"" },
364 {
"\\key\\value1",
"key",
"value2", 1,
"\\key\\value2" },
365 {
"\\key\\value1",
"key",
"", 1,
"" },
366 {
"\\key\\value1",
"",
"value2", 1,
"\\key\\value1\\\\value2" },
367 {
"\\key\\value1",
"ke\"y",
"value2", 0,
"\\key\\value1" },
368 {
"\\key\\value1",
"ke\\y",
"value2", 0,
"\\key\\value1" },
369 {
"\\key\\value1",
"ke;y",
"value2", 0,
"\\key\\value1" },
370 {
"\\key\\value1",
"ke\xa2y",
"value2", 0,
"\\key\\value1" },
371 {
"\\key\\value1",
"ke\xdcy",
"value2", 0,
"\\key\\value1" },
372 {
"\\key\\value1",
"ke\xbby",
"value2", 0,
"\\key\\value1" },
373 {
"\\key\\value1",
"key",
"val\"ue2", 0,
"\\key\\value1" },
374 {
"\\key\\value1",
"key",
"val\\ue2", 0,
"\\key\\value1" },
375 {
"\\key\\value1",
"key",
"val;ue2", 0,
"\\key\\value1" },
376 {
"\\key\\value1",
"key",
"val\xa2ue2", 0,
"\\key\\value1" },
377 {
"\\key\\value1",
"key",
"val\xdcue2", 0,
"\\key\\value1" },
378 {
"\\key\\value1",
"key",
"val\xbbue2", 0,
"\\key\\value1" },
379 {
"\\key1\\value1\\key2\\value2",
"key1",
"value3", 1,
"\\key2\\value2\\key1\\value3" },
380 {
"\\key1\\value1\\key2\\value2",
"key1",
"", 1,
"\\key2\\value2" },
381 {
"\\key1\\value1\\key2\\value2\\key1\\value3",
"key1",
"value4", 1,
"\\key2\\value2\\key1\\value4" },
382 {
"\\key1\\value1\\key2\\value2",
"key1",
"v\xe1lue3", 1,
"\\key2\\value2\\key1\\value3" },
383 {
"\\key\\value",
"key",
"\r\n", 1,
"\\key\\" },
384 {
"\\key1\\value1\\key2\\value2",
"key1",
"\r\n", 1,
"\\key2\\value2\\key1\\" },
394 char buffer[MAX_INFO_STRING];
402 if (result != v->
result) {
403 Com_EPrintf(
"Info_Validate( \"%s\" ) == %d, expected %d\n",
413 if (strcmp(buffer, r->
result)) {
414 Com_EPrintf(
"Info_RemoveKey( \"%s\", \"%s\" ) == \"%s\", expected \"%s\"\n",
425 Com_EPrintf(
"Info_SetValueForKey( \"%s\", \"%s\", \"%s\" ) == \"%s\" (%d), expected \"%s\" (%d)\n",
431 Com_Printf(
"%d failures, %d strings tested\n", errors,
451 { 12, 11, 11, 0, 0,
"hello world" },
452 { 11,
OV, 10, 1, 0,
"hello worl" },
453 { 10,
OV, 9, 1, 0,
"hello wor" },
454 { 0, 11, 0, 1, 1,
"xxxxxxxxxxxxxxx" },
471 ptr = t->
size ? buf : NULL;
473 memset(buf,
'x', 15); buf[15] = 0;
475 overflow = len >= t->
size;
477 Com_EPrintf(
"%s( %p, %"PRIz
" ) == \"%s\" (%"PRIz
") [%d], expected \"%s\" (%"PRIz
") [%d]\n",
482 memset(buf,
'x', 15); buf[15] = 0;
484 overflow = len >= t->
size;
486 Com_EPrintf(
"%s( %p, %"PRIz
" ) == \"%s\" (%"PRIz
") [%d], expected \"%s\" (%"PRIz
") [%d]\n",
496 static void Com_TestModels_f(
void)
499 int i, count, errors;
502 list =
FS_ListFiles(
"models",
".md2", FS_SEARCH_SAVEPATH, &count);
504 Com_Printf(
"No models found\n");
511 for (i = 0; i < count; i++) {
520 Com_Printf(
"%d msec, %d failures, %d models tested\n",
521 end - start, errors, count);
static void Com_TestWild_f(void)
static const int num_info_remove_tests
static void Com_Error_f(void)
qboolean Info_Validate(const char *s)
static const normtest_t normtests[]
size_t Q_snprintf(char *dest, size_t size, const char *fmt,...)
static const int num_info_validate_tests
static void BSP_Test_f(void)
void Cmd_AddCommand(const char *name, xcommand_t function)
static void Com_PrintJunk_f(void)
static const wildtest_t wildtests[]
const char * Q_ErrorString(qerror_t error)
void FS_FreeList(void **list)
static const info_remove_test_t info_remove_tests[]
static const info_validate_test_t info_validate_tests[]
static const int numnormtests
static void Com_Crash_f(void)
unsigned Sys_Milliseconds(void)
static const int num_snprintf_tests
void Com_Error(error_type_t type, const char *fmt,...)
void BSP_Free(bsp_t *bsp)
qhandle_t R_RegisterModel(const char *name)
static void Com_ErrorDrop_f(void)
void ** FS_ListFiles(const char *path, const char *filter, unsigned flags, int *count_p)
void(APIENTRY *qwglDrawBuffer)(GLenum mode)
size_t Q_strlcpy(char *dst, const char *src, size_t size)
static const snprintf_test_t snprintf_tests[]
static void Com_TestSnprintf_f(void)
static void Com_TestNorm_f(void)
static void Com_TestInfo_f(void)
static const int num_info_set_tests
qerror_t BSP_Load(const char *name, bsp_t **bsp_p)
static void Com_Freeze_f(void)
qboolean Info_SetValueForKey(char *s, const char *key, const char *value)
static const int numwildtests
size_t Q_scnprintf(char *dest, size_t size, const char *fmt,...)
size_t FS_NormalizePath(char *out, const char *in)
static const info_set_test_t info_set_tests[]
void Info_RemoveKey(char *s, const char *key)