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 086d353b..b81d4367 100644 --- a/test/test_overflow.c +++ b/test/test_overflow.c @@ -12,17 +12,18 @@ static const size_t min_stack_size = 4U * sizeof(size_t) + 240U; 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) { SerdLimits limits = serd_world_limits(world); limits.reader_stack_size = stack_size; serd_world_set_limits(world, limits); SerdSink* sink = serd_sink_new(NULL, NULL, NULL); - SerdReader* const reader = serd_reader_new(world, syntax, 0U, sink); + SerdReader* const reader = serd_reader_new(world, syntax, flags, sink); if (!reader) { return SERD_BAD_STACK; } @@ -43,17 +44,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_BAD_STACK); } } @@ -75,7 +77,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); @@ -97,6 +99,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> .", @@ -164,7 +167,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); |