mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 20:41:20 +00:00
More file splitting for code reuse.
This commit is contained in:
parent
dadfb78992
commit
581972c905
3 changed files with 57 additions and 54 deletions
|
@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS= foreign
|
|||
INCLUDES= -I$(srcdir) -I$(top_srcdir)/include
|
||||
|
||||
check_PROGRAMS=testclip
|
||||
EXTRA_DIST= trace-id.c trace-qf-bad.c hulls.h
|
||||
EXTRA_DIST= trace-id.c trace-qf-bad.c hulls.h main.c
|
||||
|
||||
testclip_SOURCES=testclip.c hulls.c
|
||||
testclip_LDADD= $(top_builddir)/libs/models/libQFmodels.la $(top_builddir)/libs/util/libQFutil.la
|
||||
|
|
55
libs/models/test/main.c
Normal file
55
libs/models/test/main.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
#define num_tests (sizeof (tests) / sizeof (tests[0]))
|
||||
|
||||
static int test_enabled[num_tests] = { 0 };
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
// vec3_t start, end;
|
||||
int c;
|
||||
size_t i, test;
|
||||
int pass = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "qvt:")) != EOF) {
|
||||
switch (c) {
|
||||
case 'q':
|
||||
verbose--;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 't':
|
||||
test = atoi (optarg);
|
||||
if (test < num_tests) {
|
||||
test_enabled[test] = 1;
|
||||
} else {
|
||||
fprintf (stderr, "Bad test number (0 - %zd)\n", num_tests);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "-q (quiet) -v (verbose) and/or -t TEST "
|
||||
"(test number)\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_tests; i++)
|
||||
if (test_enabled[i])
|
||||
break;
|
||||
if (i == num_tests) {
|
||||
for (i = 0; i < num_tests; i++)
|
||||
test_enabled[i] = 1;
|
||||
}
|
||||
|
||||
if (verbose > 0)
|
||||
printf ("start -> end => stop frac allsolid startsolid inopen "
|
||||
"inwater\n");
|
||||
for (i = 0; i < num_tests; i++) {
|
||||
if (!test_enabled[i])
|
||||
continue;
|
||||
pass &= run_test (&tests[i]);
|
||||
}
|
||||
|
||||
return !pass;
|
||||
}
|
|
@ -174,8 +174,6 @@ test_t tests[] = {
|
|||
};
|
||||
#define num_tests (sizeof (tests) / sizeof (tests[0]))
|
||||
|
||||
static int test_enabled[num_tests] = { 0 };
|
||||
|
||||
int verbose = 0;
|
||||
|
||||
static trace_t
|
||||
|
@ -363,54 +361,4 @@ nodeleaf_bail:
|
|||
return res;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
// vec3_t start, end;
|
||||
int c;
|
||||
size_t i, test;
|
||||
int pass = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "qvt:")) != EOF) {
|
||||
switch (c) {
|
||||
case 'q':
|
||||
verbose--;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 't':
|
||||
test = atoi (optarg);
|
||||
if (test < num_tests) {
|
||||
test_enabled[test] = 1;
|
||||
} else {
|
||||
fprintf (stderr, "Bad test number (0 - %zd)\n", num_tests);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, "-q (quiet) -v (verbose) and/or -t TEST "
|
||||
"(test number)\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < num_tests; i++)
|
||||
if (test_enabled[i])
|
||||
break;
|
||||
if (i == num_tests) {
|
||||
for (i = 0; i < num_tests; i++)
|
||||
test_enabled[i] = 1;
|
||||
}
|
||||
|
||||
if (verbose > 0)
|
||||
printf ("start -> end => stop frac allsolid startsolid inopen "
|
||||
"inwater\n");
|
||||
for (i = 0; i < num_tests; i++) {
|
||||
if (!test_enabled[i])
|
||||
continue;
|
||||
pass &= run_test (&tests[i]);
|
||||
}
|
||||
|
||||
return !pass;
|
||||
}
|
||||
#include "main.c"
|
||||
|
|
Loading…
Reference in a new issue