diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/meson.build | 6 | ||||
-rw-r--r-- | test/test_read_chunk.c | 2 | ||||
-rw-r--r-- | test/test_reader_writer.c | 17 | ||||
-rw-r--r-- | test/test_string.c | 2 |
4 files changed, 17 insertions, 10 deletions
diff --git a/test/meson.build b/test/meson.build index 794dec2c..3ec9d38b 100644 --- a/test/meson.build +++ b/test/meson.build @@ -46,7 +46,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 @@ -61,6 +61,10 @@ if get_option('utils') ['-i', 'turtle'], ['-i'], ['-fi'], + ['-k'], + ['-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 ce529b67..17421a52 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 d5669db0..62b77f1b 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -100,7 +100,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); @@ -160,7 +160,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); @@ -275,14 +275,17 @@ test_writer(const char* const path) static void 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); - - assert(reader); + ReaderTest rt = {0, NULL}; + SerdSink* const sink = serd_sink_new(&rt, NULL); assert(sink); serd_sink_set_statement_func(sink, test_sink); + // Test that too little stack space fails gracefully + assert(!serd_reader_new(SERD_TURTLE, sink, 32)); + + SerdReader* reader = serd_reader_new(SERD_TURTLE, sink, 4096); + assert(reader); + SerdNode* g = serd_new_uri(SERD_STRING("http://example.org/")); serd_reader_set_default_graph(reader, g); serd_reader_add_blank_prefix(reader, "tmp"); 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")); } |