aboutsummaryrefslogtreecommitdiffstats
path: root/tests/serd_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r--tests/serd_test.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 8426b5df..cdea3810 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -424,9 +424,10 @@ main(void)
serd_writer_chop_blank_prefix(writer, "tmp");
serd_writer_chop_blank_prefix(writer, NULL);
- assert(serd_writer_set_base_uri(writer, lit));
- assert(serd_writer_set_prefix(writer, lit, lit));
- assert(serd_writer_end_anon(writer, NULL));
+ const SerdSink* iface = serd_writer_get_sink(writer);
+ assert(iface->base(iface->handle, lit));
+ assert(iface->prefix(iface->handle, lit, lit));
+ assert(iface->end(iface->handle, NULL));
assert(serd_writer_get_env(writer) == env);
uint8_t buf[] = { 0xEF, 0xBF, 0xBD, 0 };
@@ -446,8 +447,8 @@ main(void)
{ s, p, NULL },
{ NULL, NULL, NULL } };
for (unsigned i = 0; i < sizeof(junk) / (sizeof(SerdNode*) * 5); ++i) {
- assert(serd_writer_write_statement(
- writer, 0, NULL,
+ assert(iface->statement(
+ iface->handle, 0, NULL,
junk[i][0], junk[i][1], junk[i][2]));
}
@@ -464,27 +465,23 @@ main(void)
{ s, p, o },
{ s, p, o } };
for (unsigned i = 0; i < sizeof(good) / (sizeof(SerdNode*) * 5); ++i) {
- assert(!serd_writer_write_statement(
- writer, 0, NULL,
- good[i][0], good[i][1], good[i][2]));
+ assert(!iface->statement(
+ iface->handle, 0, NULL, good[i][0], good[i][1], good[i][2]));
}
// Write statements with bad UTF-8 (should be replaced)
const char bad_str[] = { (char)0xFF, (char)0x90, 'h', 'i', 0 };
SerdNode* bad_lit = serd_node_new_string(SERD_LITERAL, bad_str);
SerdNode* bad_uri = serd_node_new_string(SERD_URI, bad_str);
- assert(!serd_writer_write_statement(
- writer, 0, NULL, s, p, bad_lit));
- assert(!serd_writer_write_statement(writer, 0, NULL,
- s, p, bad_uri));
+ assert(!iface->statement(iface->handle, 0, NULL, s, p, bad_lit));
+ assert(!iface->statement(iface->handle, 0, NULL, s, p, bad_uri));
serd_node_free(bad_lit);
serd_node_free(bad_uri);
// Write 1 valid statement
serd_node_free(o);
o = serd_node_new_string(SERD_LITERAL, "hello");
- assert(!serd_writer_write_statement(writer, 0, NULL,
- s, p, o));
+ assert(!iface->statement(iface->handle, 0, NULL, s, p, o));
serd_writer_free(writer);
serd_node_free(lit);
@@ -513,11 +510,9 @@ main(void)
fseek(fd, 0, SEEK_SET);
ReaderTest* rt = (ReaderTest*)calloc(1, sizeof(ReaderTest));
- SerdReader* reader = serd_reader_new(
- SERD_TURTLE, rt, free,
- NULL, NULL, test_sink, NULL);
+ SerdSink sink = { rt, NULL, NULL, test_sink, NULL };
+ SerdReader* reader = serd_reader_new(SERD_TURTLE, &sink);
assert(reader);
- assert(serd_reader_get_handle(reader) == rt);
SerdNode* g = serd_node_new_string(SERD_URI, "http://example.org/");
serd_reader_set_default_graph(reader, g);
@@ -538,6 +533,7 @@ main(void)
assert(serd_reader_read_string(reader, "This isn't Turtle at all."));
serd_reader_free(reader);
+ free(rt);
fclose(fd);
serd_env_free(env);