aboutsummaryrefslogtreecommitdiffstats
path: root/tests/serd_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-24 23:37:00 +0000
committerDavid Robillard <d@drobilla.net>2011-12-24 23:37:00 +0000
commit2501f12f80c3eebed55e5b253ced5a29ac443949 (patch)
treebdd4603dd23ce9b8b2540d7d75ba1e4c5a6b3e05 /tests/serd_test.c
parent6f523cba5f55785e75d7b0f43e97550a4b1ee4b1 (diff)
downloadserd-2501f12f80c3eebed55e5b253ced5a29ac443949.tar.gz
serd-2501f12f80c3eebed55e5b253ced5a29ac443949.tar.bz2
serd-2501f12f80c3eebed55e5b253ced5a29ac443949.zip
Cover serd_node_from_string.
git-svn-id: http://svn.drobilla.net/serd/trunk@275 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r--tests/serd_test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 725517b4..c5c650da 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -155,6 +155,7 @@ main()
}
// Test serd_uri_to_path
+
const uint8_t* uri = (const uint8_t*)"file:///home/user/foo.ttl";
if (strcmp((const char*)serd_uri_to_path(uri), "/home/user/foo.ttl")) {
fprintf(stderr, "Bad path %s for %s\n", serd_uri_to_path(uri), uri);
@@ -176,6 +177,16 @@ main()
return 1;
}
+ // Test serd_node_from_string
+
+ SerdNode node = serd_node_from_string(SERD_LITERAL, (const uint8_t*)"hello\"");
+ if (node.n_bytes != 6 || node.n_chars != 6 || node.flags != SERD_HAS_QUOTE
+ || strcmp((const char*)node.buf, "hello\"")) {
+ fprintf(stderr, "Bad node %s %zu %zu %d %d\n",
+ node.buf, node.n_bytes, node.n_chars, node.flags, node.type);
+ return 1;
+ }
+
printf("Success\n");
return 0;
}