aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_read_chunk.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_read_chunk.c')
-rw-r--r--test/test_read_chunk.c38
1 files changed, 15 insertions, 23 deletions
diff --git a/test/test_read_chunk.c b/test/test_read_chunk.c
index dd2961ac..76e9b642 100644
--- a/test/test_read_chunk.c
+++ b/test/test_read_chunk.c
@@ -19,8 +19,7 @@
#include "serd/serd.h"
#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
+#include <stddef.h>
static size_t n_base = 0;
static size_t n_prefix = 0;
@@ -80,39 +79,32 @@ on_end(void* handle, const SerdNode* node)
int
main(void)
{
- FILE* file = tmpfile();
-
- fprintf(file,
- "@prefix eg: <http://example.org/> .\n"
- "@base <http://example.org/base> .\n"
- "eg:s1 eg:p1 eg:o1 ;\n"
- " eg:p2 eg:o2 ,\n"
- " eg:o3 .\n"
- "eg:s2 eg:p1 eg:o1 ;\n"
- " eg:p2 eg:o2 .\n"
- "eg:s3 eg:p1 eg:o1 .\n"
- "eg:s4 eg:p1 [ eg:p3 eg:o1 ] .\n");
-
- fseek(file, 0, SEEK_SET);
-
SerdReader* reader = serd_reader_new(
SERD_TURTLE, NULL, NULL, on_base, on_prefix, on_statement, on_end);
-
assert(reader);
- assert(!serd_reader_start_stream(reader, file, NULL, true));
+
+ assert(!serd_reader_start_string(reader,
+ "@prefix eg: <http://example.org/> .\n"
+ "@base <http://example.org/base> .\n"
+ "eg:s1 eg:p1 eg:o1 ;\n"
+ " eg:p2 eg:o2 ,\n"
+ " eg:o3 .\n"
+ "eg:s2 eg:p1 eg:o1 ;\n"
+ " eg:p2 eg:o2 .\n"
+ "eg:s3 eg:p1 eg:o1 .\n"
+ "eg:s4 eg:p1 [ eg:p3 eg:o1 ] .\n"));
assert(!serd_reader_read_chunk(reader) && n_prefix == 1);
assert(!serd_reader_read_chunk(reader) && n_base == 1);
assert(!serd_reader_read_chunk(reader) && n_statement == 3);
assert(!serd_reader_read_chunk(reader) && n_statement == 5);
assert(!serd_reader_read_chunk(reader) && n_statement == 6);
- assert(!serd_reader_read_chunk(reader) && n_statement == 8 && n_end == 1);
+ assert(!serd_reader_read_chunk(reader) && n_statement == 8);
assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
+ assert(n_end == 1);
assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
-
assert(!serd_reader_end_stream(reader));
- serd_reader_free(reader);
- fclose(file);
+ serd_reader_free(reader);
return 0;
}