diff options
Diffstat (limited to 'src/geometry')
-rw-r--r-- | src/geometry/geometry.c | 12 | ||||
-rw-r--r-- | src/geometry/geometry.h | 3 | ||||
-rw-r--r-- | src/geometry/geometry.test.c | 15 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/geometry/geometry.c b/src/geometry/geometry.c index ba1ca58..5e93c55 100644 --- a/src/geometry/geometry.c +++ b/src/geometry/geometry.c @@ -2,4 +2,16 @@ #include <kalmia.h> #include "util/util.h" +#include "xml/xml.h" #include "geometry.h" + + +int kai_read_float_array(struct ka_float_array_t *dest, struct kai_tag_t *src) +{ + if (strcmp(src->type, "float_array") != 0) { + /* incorrect tag type */ + return -1; + } + + return 0; +} diff --git a/src/geometry/geometry.h b/src/geometry/geometry.h index da089c1..1672ffa 100644 --- a/src/geometry/geometry.h +++ b/src/geometry/geometry.h @@ -2,5 +2,8 @@ #define KALMIA_GEOMETRY_H #include <kalmia.h> +#include "xml/xml.h" + +int kai_read_float_array(struct ka_float_array_t *dest, struct kai_tag_t *src); #endif diff --git a/src/geometry/geometry.test.c b/src/geometry/geometry.test.c index fe4421e..b724ee7 100644 --- a/src/geometry/geometry.test.c +++ b/src/geometry/geometry.test.c @@ -8,5 +8,20 @@ LILY_FILE_BEGIN(geometry_suite) +LILY_TEST("fail to read non-float_array") +{ + struct kai_tag_t *t = kai_parse_string( + "<non_float_array></non_float_array>" + ); + + struct ka_float_array_t arr; + int result = kai_read_float_array(&arr, t); + CHECK_EQF(result, -1, "%d"); + + kai_tag_destroy(t); +} +#include LILY_PUSH_TEST() + + #define LILY_FILE_END #include LILY_REGISTER_TESTS() |