diff options
Diffstat (limited to 'src/geometry/geometry.test.c')
-rw-r--r-- | src/geometry/geometry.test.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/geometry/geometry.test.c b/src/geometry/geometry.test.c index 56673a4..dec16e9 100644 --- a/src/geometry/geometry.test.c +++ b/src/geometry/geometry.test.c @@ -68,5 +68,54 @@ LILY_TEST("read normal float_array") #include LILY_PUSH_TEST() +LILY_TEST("fail to read non-param tag") +{ + struct kai_tag_t *t = kai_parse_string( + "<tag />" + ); + + struct ka_param_t param; + int result = kai_read_param(¶m, t); + CHECK_EQ(result, -1, "%d"); + + kai_tag_destroy(t); +} +#include LILY_PUSH_TEST() + + +LILY_TEST("fail to read param tag with no specified type") +{ + struct kai_tag_t *t = kai_parse_string( + "<param />" + ); + + struct ka_param_t param; + int result = kai_read_param(¶m, t); + CHECK_EQ(result, -1, "%d"); + + kai_tag_destroy(t); +} +#include LILY_PUSH_TEST() + + +LILY_TEST("read param tag") +{ + struct kai_tag_t *t = kai_parse_string( + "<param type=\"float\" name=\"x\" />" + ); + + struct ka_param_t param; + int result = kai_read_param(¶m, t); + kai_tag_destroy(t); + + REQUIRE_EQ(result, 0, "%d"); + CHECK_EQS(param.name, "x"); + CHECK_EQ(param.sid, NULL, "%p"); + CHECK_EQS(param.type, "float"); + CHECK_EQ(param.semantic, NULL, "%p"); +} +#include LILY_PUSH_TEST() + + #define LILY_FILE_END #include LILY_REGISTER_TESTS() |