aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-13 19:34:11 +0100
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:05 -0500
commit2e25fe1e64f487fd91ff6f636bf3249b761ffcdc (patch)
tree73dc6d1731442acd26ea5b1f11de000c8dd31967 /test
parente6abc21f9bde66d8f60078493354ba3713f9fcd8 (diff)
downloadserd-2e25fe1e64f487fd91ff6f636bf3249b761ffcdc.tar.gz
serd-2e25fe1e64f487fd91ff6f636bf3249b761ffcdc.tar.bz2
serd-2e25fe1e64f487fd91ff6f636bf3249b761ffcdc.zip
Use a fixed-size reader stack
This improves performance, and makes the reader more suitable for embedded or network-facing applications, at the cost of requiring the user to specify a maximum stack size.
Diffstat (limited to 'test')
-rw-r--r--test/meson.build5
-rw-r--r--test/test_read_chunk.c2
-rw-r--r--test/test_reader_writer.c6
-rw-r--r--test/test_string.c2
4 files changed, 9 insertions, 6 deletions
diff --git a/test/meson.build b/test/meson.build
index a8c21e78..e45af26c 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -42,7 +42,7 @@ if get_option('utils')
good_args = [
['-v'],
['-h'],
- ['-s', '<urn:eg:s> a <urn:eg:T> .'],
+ ['-k', '512', '-s', '<urn:eg:s> a <urn:eg:T> .'],
]
foreach args : good_args
@@ -53,6 +53,9 @@ if get_option('utils')
['-c'],
['-i', 'unknown'],
['-i'],
+ ['-k', '-1'],
+ ['-k', '9223372036854775807'],
+ ['-k', '1024junk'],
['-o', 'unknown'],
['-o'],
['-p'],
diff --git a/test/test_read_chunk.c b/test/test_read_chunk.c
index df8b43c2..9a482c02 100644
--- a/test/test_read_chunk.c
+++ b/test/test_read_chunk.c
@@ -85,7 +85,7 @@ main(void)
serd_sink_set_statement_func(sink, on_statement);
serd_sink_set_end_func(sink, on_end);
- SerdReader* reader = serd_reader_new(SERD_TURTLE, sink);
+ SerdReader* reader = serd_reader_new(SERD_TURTLE, sink, 4096);
assert(reader);
assert(!serd_reader_start_string(reader,
diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c
index 697469a9..b39ea761 100644
--- a/test/test_reader_writer.c
+++ b/test/test_reader_writer.c
@@ -83,7 +83,7 @@ test_read_chunks(void)
FILE* const f = tmpfile();
static const char null = 0;
SerdSink* sink = serd_sink_new(rt, NULL);
- SerdReader* reader = serd_reader_new(SERD_TURTLE, sink);
+ SerdReader* reader = serd_reader_new(SERD_TURTLE, sink, 4096);
assert(reader);
assert(sink);
@@ -143,7 +143,7 @@ test_read_string(void)
{
ReaderTest* rt = (ReaderTest*)calloc(1, sizeof(ReaderTest));
SerdSink* sink = serd_sink_new(rt, NULL);
- SerdReader* reader = serd_reader_new(SERD_TURTLE, sink);
+ SerdReader* reader = serd_reader_new(SERD_TURTLE, sink, 4096);
assert(reader);
assert(sink);
@@ -261,7 +261,7 @@ test_reader(const char* path)
{
ReaderTest rt = {0, NULL};
SerdSink* const sink = serd_sink_new(&rt, NULL);
- SerdReader* reader = serd_reader_new(SERD_TURTLE, sink);
+ SerdReader* reader = serd_reader_new(SERD_TURTLE, sink, 4096);
assert(reader);
assert(sink);
diff --git a/test/test_string.c b/test/test_string.c
index 842ff3df..a3fb9247 100644
--- a/test/test_string.c
+++ b/test/test_string.c
@@ -39,7 +39,7 @@ test_strerror(void)
{
const char* msg = serd_strerror(SERD_SUCCESS);
assert(!strcmp(msg, "Success"));
- for (int i = SERD_FAILURE; i <= SERD_ERR_INTERNAL; ++i) {
+ for (int i = SERD_FAILURE; i <= SERD_ERR_OVERFLOW; ++i) {
msg = serd_strerror((SerdStatus)i);
assert(strcmp(msg, "Success"));
}