diff options
Diffstat (limited to 'test/test_overflow.c')
-rw-r--r-- | test/test_overflow.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/test/test_overflow.c b/test/test_overflow.c index 6d5c6d0c..335cd5c7 100644 --- a/test/test_overflow.c +++ b/test/test_overflow.c @@ -25,15 +25,16 @@ static const size_t min_stack_size = 4 * sizeof(size_t) + 256u; static const size_t max_stack_size = 1024u; static SerdStatus -test_size(SerdWorld* const world, - const char* const str, - const SerdSyntax syntax, - const size_t stack_size) +test_size(SerdWorld* const world, + const char* const str, + const SerdSyntax syntax, + const SerdReaderFlags flags, + const size_t stack_size) { SerdSink* sink = serd_sink_new(NULL, NULL, NULL); SerdByteSource* byte_source = serd_byte_source_new_string(str, NULL); SerdReader* const reader = - serd_reader_new(world, syntax, 0u, sink, stack_size); + serd_reader_new(world, syntax, flags, sink, stack_size); assert(reader); @@ -47,17 +48,18 @@ test_size(SerdWorld* const world, } static void -test_all_sizes(SerdWorld* const world, - const char* const str, - const SerdSyntax syntax) +test_all_sizes(SerdWorld* const world, + const char* const str, + const SerdSyntax syntax, + const SerdReaderFlags flags) { // Ensure reading with the maximum stack size succeeds - SerdStatus st = test_size(world, str, syntax, max_stack_size); + SerdStatus st = test_size(world, str, syntax, flags, max_stack_size); assert(!st); // Test with an increasingly smaller stack for (size_t size = max_stack_size; size > min_stack_size; --size) { - if ((st = test_size(world, str, syntax, size))) { + if ((st = test_size(world, str, syntax, flags, size))) { assert(st == SERD_ERR_OVERFLOW); } } @@ -76,7 +78,7 @@ test_ntriples_overflow(void) SerdWorld* const world = serd_world_new(); for (const char* const* t = test_strings; *t; ++t) { - test_all_sizes(world, *t, SERD_NTRIPLES); + test_all_sizes(world, *t, SERD_NTRIPLES, 0u); } serd_world_free(world); @@ -98,6 +100,7 @@ test_turtle_overflow(void) "<http://example.org/s> <http://example.org/p> _:blank .", "<http://example.org/s> <http://example.org/p> true .", "<http://example.org/s> <http://example.org/p> \"\"@en .", + "?subject ?predicate ?object .", "(((((((((42))))))))) <http://example.org/p> <http://example.org/o> .", "@prefix eg: <http://example.org/ns/test> .", "@base <http://example.org/base> .", @@ -165,7 +168,7 @@ test_turtle_overflow(void) SerdWorld* const world = serd_world_new(); for (const char* const* t = test_strings; *t; ++t) { - test_all_sizes(world, *t, SERD_TURTLE); + test_all_sizes(world, *t, SERD_TURTLE, SERD_READ_VARIABLES); } serd_world_free(world); |