aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_reader_writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-16 12:42:58 +0200
committerDavid Robillard <d@drobilla.net>2021-03-07 15:32:24 -0500
commit9a8e06aa5bdc62ed589bd8ed5789bd059cec0700 (patch)
treeba5263262fad84c5f58bd60f3c6f6fcba30d6516 /test/test_reader_writer.c
parentd4ae57afbd7da668dbf89f7b7e66e2f064437a98 (diff)
downloadserd-9a8e06aa5bdc62ed589bd8ed5789bd059cec0700.tar.gz
serd-9a8e06aa5bdc62ed589bd8ed5789bd059cec0700.tar.bz2
serd-9a8e06aa5bdc62ed589bd8ed5789bd059cec0700.zip
Simplify reader interface
Diffstat (limited to 'test/test_reader_writer.c')
-rw-r--r--test/test_reader_writer.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c
index 5431462a..48bb508e 100644
--- a/test/test_reader_writer.c
+++ b/test/test_reader_writer.c
@@ -19,7 +19,6 @@
#include "serd/serd.h"
#include <assert.h>
-#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -89,7 +88,8 @@ test_read_chunks(void)
assert(serd_reader_handle(reader) == rt);
assert(f);
- SerdStatus st = serd_reader_start_stream(reader, f, NULL, false);
+ SerdStatus st = serd_reader_start_stream(
+ reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, f, NULL, 1);
assert(st == SERD_SUCCESS);
// Write two statement separated by null characters
@@ -292,7 +292,8 @@ test_reader(const char* path)
fflush(temp);
fseek(temp, 0L, SEEK_SET);
- serd_reader_start_stream(reader, temp, NULL, true);
+ serd_reader_start_stream(
+ reader, (SerdSource)fread, (SerdStreamErrorFunc)ferror, temp, NULL, 4096);
assert(serd_reader_read_chunk(reader) == SERD_SUCCESS);
assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
@@ -305,12 +306,12 @@ test_reader(const char* path)
// A byte-wise reader that hits EOF once then continues (like a socket)
{
size_t n_reads = 0;
- serd_reader_start_source_stream(reader,
- (SerdSource)eof_test_read,
- (SerdStreamErrorFunc)eof_test_error,
- &n_reads,
- NULL,
- 1);
+ serd_reader_start_stream(reader,
+ (SerdSource)eof_test_read,
+ (SerdStreamErrorFunc)eof_test_error,
+ &n_reads,
+ NULL,
+ 1);
assert(serd_reader_read_chunk(reader) == SERD_SUCCESS);
assert(serd_reader_read_chunk(reader) == SERD_FAILURE);