diff --git a/libs/util/test/test-seg.c b/libs/util/test/test-seg.c index 7c36cec17..d67001394 100644 --- a/libs/util/test/test-seg.c +++ b/libs/util/test/test-seg.c @@ -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; }