diff options
author | David Robillard <d@drobilla.net> | 2018-12-30 12:34:24 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-13 19:15:32 +0200 |
commit | b58e829adcaca5a74f666a3f1b4c76644a7d49b7 (patch) | |
tree | a41b4bda0bffbf5f752e939dd27299965046d0a2 | |
parent | 9b580f1a46571424e85b5fd9f41cb32df92ca7e0 (diff) | |
download | serd-b58e829adcaca5a74f666a3f1b4c76644a7d49b7.tar.gz serd-b58e829adcaca5a74f666a3f1b4c76644a7d49b7.tar.bz2 serd-b58e829adcaca5a74f666a3f1b4c76644a7d49b7.zip |
Simplify reader test sink
-rw-r--r-- | tests/serd_test.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index a2bb9013..bab255e6 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -62,20 +62,15 @@ count_prefixes(void* handle, const SerdNode* name, const SerdNode* uri) return SERD_SUCCESS; } -typedef struct { - int n_statements; -} ReaderTest; - static SerdStatus -test_sink(void* handle, - SerdStatementFlags flags, - const SerdStatement* statement) +count_statements(void* handle, + SerdStatementFlags flags, + const SerdStatement* statement) { (void)flags; (void)statement; - ReaderTest* rt = (ReaderTest*)handle; - ++rt->n_statements; + ++*(size_t*)handle; return SERD_SUCCESS; } @@ -602,9 +597,9 @@ main(void) // Rewind and test reader fseek(fd, 0, SEEK_SET); - ReaderTest rt = { 0 }; - SerdSink* sink = serd_sink_new(&rt); - serd_sink_set_statement_func(sink, test_sink); + size_t n_statements = 0; + SerdSink* sink = serd_sink_new(&n_statements); + serd_sink_set_statement_func(sink, count_statements); SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); assert(reader); @@ -618,7 +613,7 @@ main(void) assert(!serd_reader_start_file(reader, path, true)); assert(!serd_reader_read_document(reader)); - assert(rt.n_statements == 13); + assert(n_statements == 13); serd_reader_finish(reader); serd_reader_free(reader); |