summaryrefslogtreecommitdiff
path: root/src/geometry/geometry.test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/geometry/geometry.test.c')
-rw-r--r--src/geometry/geometry.test.c116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/geometry/geometry.test.c b/src/geometry/geometry.test.c
index 298de3a..f9dc3de 100644
--- a/src/geometry/geometry.test.c
+++ b/src/geometry/geometry.test.c
@@ -237,5 +237,121 @@ LILY_TEST("read source correctly")
#include LILY_PUSH_TEST()
+LILY_TEST("fail to read non-input (unshared) tag")
+{
+ struct kai_tag_t *t = kai_parse_string(
+ "<tag />"
+ );
+
+ struct ka_input_t input_unshared;
+ int result = kai_read_input_unshared(&input_unshared, t);
+ CHECK_EQ(result, -1, "%d");
+
+ kai_tag_destroy(t);
+}
+#include LILY_PUSH_TEST()
+
+
+LILY_TEST("fail to read input (unshared) tag with no specified semantic or source")
+{
+ struct kai_tag_t *t = kai_parse_string(
+ "<input />"
+ );
+
+ struct ka_input_t input_unshared;
+ int result = kai_read_input_unshared(&input_unshared, t);
+ CHECK_EQ(result, -1, "%d");
+ kai_tag_destroy(t);
+
+ t = kai_parse_string(
+ "<input semantic=\"xxx\" />"
+ );
+ result = kai_read_input_unshared(&input_unshared, t);
+ CHECK_EQ(result, -1, "%d");
+ kai_tag_destroy(t);
+
+ t = kai_parse_string(
+ "<input source=\"xxx\" />"
+ );
+ result = kai_read_input_unshared(&input_unshared, t);
+ CHECK_EQ(result, -1, "%d");
+ kai_tag_destroy(t);
+}
+#include LILY_PUSH_TEST()
+
+
+LILY_TEST("read input (unshared)")
+{
+ struct kai_tag_t *t = kai_parse_string(
+ "<input semantic=\"xxx\" source=\"yyy\" />"
+ );
+
+ struct ka_input_t input_unshared;
+ int result = kai_read_input_unshared(&input_unshared, t);
+ kai_tag_destroy(t);
+
+ CHECK_EQ(result, 0, "%d");
+ CHECK_EQ(input_unshared.shared, false, "%d");
+ CHECK_EQS(input_unshared.semantic, "xxx");
+ CHECK_EQS(input_unshared.source, "yyy");
+
+ kai_release_input(input_unshared);
+}
+#include LILY_PUSH_TEST()
+
+
+LILY_TEST("fail to read input (shared) with no offset")
+{
+ struct kai_tag_t *t = kai_parse_string(
+ "<input semantic=\"xxx\" source=\"yyy\" />"
+ );
+
+ struct ka_input_t input_shared;
+ int result = kai_read_input_shared(&input_shared, t);
+ kai_tag_destroy(t);
+ kai_release_input(input_shared);
+
+ CHECK_EQ(result, -1, "%d");
+}
+#include LILY_PUSH_TEST()
+
+
+LILY_TEST("read input (shared)")
+{
+ struct kai_tag_t *t = kai_parse_string(
+ "<input semantic=\"xxx\" source=\"yyy\" offset=\"10\" />"
+ );
+
+ struct ka_input_t input_shared;
+ int result = kai_read_input_shared(&input_shared, t);
+ kai_tag_destroy(t);
+
+ CHECK_EQ(result, 0, "%d");
+ CHECK_EQ(input_shared.shared, true, "%d");
+ CHECK_EQ(input_shared.offset, 10, "%d");
+ CHECK_EQS(input_shared.semantic, "xxx");
+ CHECK_EQS(input_shared.source, "yyy");
+ CHECK_EQ(input_shared.use_set, false, "%d");
+ kai_release_input(input_shared);
+
+ t = kai_parse_string(
+ "<input semantic=\"xxx\" source=\"yyy\" offset=\"10\" set=\"4\" />"
+ );
+
+ result = kai_read_input_shared(&input_shared, t);
+ kai_tag_destroy(t);
+
+ CHECK_EQ(result, 0, "%d");
+ CHECK_EQ(input_shared.shared, true, "%d");
+ CHECK_EQ(input_shared.offset, 10, "%d");
+ CHECK_EQS(input_shared.semantic, "xxx");
+ CHECK_EQS(input_shared.source, "yyy");
+ CHECK_EQ(input_shared.use_set, true, "%d");
+ CHECK_EQ(input_shared.set, 4, "%d");
+ kai_release_input(input_shared);
+}
+#include LILY_PUSH_TEST()
+
+
#define LILY_FILE_END
#include LILY_REGISTER_TESTS()