diff options
Diffstat (limited to 'tests/read_chunk_test.c')
-rw-r--r-- | tests/read_chunk_test.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/read_chunk_test.c b/tests/read_chunk_test.c index 31b11603..dfa0c0ac 100644 --- a/tests/read_chunk_test.c +++ b/tests/read_chunk_test.c @@ -70,15 +70,31 @@ on_end(void* handle, const SerdNode* node) return SERD_SUCCESS; } +static SerdStatus +on_event(void* handle, const SerdEvent* event) +{ + switch (event->type) { + case SERD_BASE: + return on_base(handle, event->base.uri); + case SERD_PREFIX: + return on_prefix(handle, event->prefix.name, event->prefix.uri); + case SERD_STATEMENT: + return on_statement(handle, + event->statement.flags, + event->statement.statement); + case SERD_END: + return on_end(handle, event->end.node); + } + + return SERD_SUCCESS; +} + int main(void) { SerdWorld* world = serd_world_new(); SerdSink* sink = serd_sink_new(NULL, NULL); - serd_sink_set_base_func(sink, on_base); - serd_sink_set_prefix_func(sink, on_prefix); - serd_sink_set_statement_func(sink, on_statement); - serd_sink_set_end_func(sink, on_end); + serd_sink_set_event_func(sink, on_event); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0, sink, 4096); assert(reader); @@ -108,5 +124,6 @@ main(void) serd_reader_free(reader); serd_sink_free(sink); serd_world_free(world); + return 0; } |