diff options
author | sanine <sanine.not@pm.me> | 2023-02-03 23:01:31 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-02-03 23:01:31 -0600 |
commit | 1b4564c02380d10f7f8630d73441e7f9aa83c812 (patch) | |
tree | da0f9294e1fc7c637547629faab4b45ed3e3494c /src/geometry | |
parent | ea512c3b1d2d85ff76aa7d4979c73dd7f1217757 (diff) |
begin implementing kai_read_float_array()
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() |