mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Add tests for chunk line numbers.
Which happen to find errors :P
This commit is contained in:
parent
d912970cd3
commit
d1848a93c8
1 changed files with 22 additions and 0 deletions
|
@ -43,6 +43,19 @@ struct {
|
|||
};
|
||||
#define num_seg_tests (sizeof (seg_tests) / sizeof (seg_tests[0]))
|
||||
|
||||
struct {
|
||||
const char *tag;
|
||||
int expect;
|
||||
} line_tests[] = {
|
||||
{"Vertex", 3},
|
||||
{"Geometry", 5},
|
||||
{"Fragment.Erosion", 7},
|
||||
{"Fragment.Grassfire", 9},
|
||||
{"TessControl", 11},
|
||||
{"TessEvaluation", 13}, // final chunk doesn't have \n
|
||||
};
|
||||
#define num_line_tests (sizeof (line_tests) / sizeof (line_tests[0]))
|
||||
|
||||
int
|
||||
main (int argc, const char **argv)
|
||||
{
|
||||
|
@ -61,5 +74,14 @@ main (int argc, const char **argv)
|
|||
res = 1;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < num_line_tests; i++) {
|
||||
const segchunk_t *chunk = Segtext_FindChunk (st, line_tests[i].tag);
|
||||
if (!chunk || chunk->start_line != line_tests[i].expect) {
|
||||
fprintf (stderr, "FAIL: (%zd) \"%s\" -> %d, got %d\n", i,
|
||||
line_tests[i].tag, line_tests[i].expect,
|
||||
chunk->start_line);
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue