summaryrefslogtreecommitdiff
path: root/src/geometry/geometry.test.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-02-05 16:52:42 -0600
committersanine <sanine.not@pm.me>2023-02-05 16:52:42 -0600
commit24d7f717b76a3c6fba44e32c2816f2ce612a2f2c (patch)
tree34474238e08f7bff47f8ec9fe1d8c76db4b63cd6 /src/geometry/geometry.test.c
parent1ba558a9c92cd61f05a695dcd2e6f75215c0c584 (diff)
implement kai_read_source() and add kai_release_ functions
Diffstat (limited to 'src/geometry/geometry.test.c')
-rw-r--r--src/geometry/geometry.test.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/geometry/geometry.test.c b/src/geometry/geometry.test.c
index fd1f379..298de3a 100644
--- a/src/geometry/geometry.test.c
+++ b/src/geometry/geometry.test.c
@@ -62,8 +62,7 @@ LILY_TEST("read normal float_array")
CHECK_EQF(arr.buf[1], 0.0, "%f");
CHECK_EQF(arr.buf[2], 0.5, "%f");
- free(arr.id);
- free(arr.buf);
+ kai_release_float_array(arr);
}
#include LILY_PUSH_TEST()
@@ -113,6 +112,8 @@ LILY_TEST("read param tag")
CHECK_EQ(param.sid, NULL, "%p");
CHECK_EQS(param.type, "float");
CHECK_EQ(param.semantic, NULL, "%p");
+
+ kai_release_param(param);
}
#include LILY_PUSH_TEST()
@@ -172,8 +173,7 @@ LILY_TEST("parse accessor")
CHECK_EQS(acc.param[1].name, "y");
CHECK_EQS(acc.param[2].name, "z");
- free(acc.source);
- for (int i=0; i<3; i++) free(acc.param[i].name);
+ kai_release_accessor(acc);
}
#include LILY_PUSH_TEST()
@@ -214,13 +214,27 @@ LILY_TEST("read source correctly")
"<source id=\"source\">"
" <float_array count=\"1\">0.0</float_array>"
" <technique_common>"
- " <accessor count=\"1\" id=\"xxx\">"
+ " <accessor count=\"1\" source=\"xxx\">"
" <param type=\"float\" />"
" </accessor>"
" </technique_common>"
"</source>"
);
+
+ struct ka_source_t source;
+ int result = kai_read_source(&source, t);
+ kai_tag_destroy(t);
+
+ CHECK_EQ(result, 0, "%d");
+ REQUIRE_EQS(source.id, "source");
+ CHECK_EQS(source.name, NULL);
+
+ CHECK_EQ(source.float_array.count, 1, "%d");
+ CHECK_EQS(source.accessor.source, "xxx");
+
+ kai_release_source(source);
}
+#include LILY_PUSH_TEST()
#define LILY_FILE_END