diff options
Diffstat (limited to 'src/geometry/geometry.test.c')
-rw-r--r-- | src/geometry/geometry.test.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/geometry/geometry.test.c b/src/geometry/geometry.test.c index f9dc3de..968060d 100644 --- a/src/geometry/geometry.test.c +++ b/src/geometry/geometry.test.c @@ -353,5 +353,62 @@ LILY_TEST("read input (shared)") #include LILY_PUSH_TEST() +LILY_TEST("fail to read non-vertices tag") +{ + struct kai_tag_t *t = kai_parse_string( + "<tag />" + ); + + struct ka_vertices_t vertices; + int result = kai_read_vertices(&vertices, t); + CHECK_EQ(result, -1, "%d"); + + kai_tag_destroy(t); +} +#include LILY_PUSH_TEST() + + +LILY_TEST("fail to read vertices tag with no specified id") +{ + struct kai_tag_t *t = kai_parse_string( + "<vertices />" + ); + + struct ka_vertices_t vertices; + int result = kai_read_vertices(&vertices, t); + CHECK_EQ(result, -1, "%d"); + kai_tag_destroy(t); +} +#include LILY_PUSH_TEST() + + +LILY_TEST("read vertices tag") +{ + struct kai_tag_t *t = kai_parse_string( + "<vertices id=\"xxx\" name=\"yyy\" >" + " <input semantic=\"zzz\" source=\"xxx\" />" + " <input semantic=\"www\" source=\"xxx\" />" + "</vertices>" + ); + + struct ka_vertices_t vertices; + vertices.input = NULL; + + int result = kai_read_vertices(&vertices, t); + kai_tag_destroy(t); + + REQUIRE_EQ(result, 0, "%d"); + CHECK_EQS(vertices.id, "xxx"); + CHECK_EQS(vertices.name, "yyy"); + CHECK_EQ(vertices.input_count, 2, "%d"); + CHECK_NEQ(vertices.input, NULL, "%p"); + + kai_release_vertices(vertices); +} +#include LILY_PUSH_TEST() + + + + #define LILY_FILE_END #include LILY_REGISTER_TESTS() |