aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_overflow.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-04-15 17:52:44 -0400
committerDavid Robillard <d@drobilla.net>2022-01-14 01:13:45 -0500
commit7269c12bbe4532f5f5844aaec16cf1bb75a1c71c (patch)
tree4fe7f6b0545cb05b2491c70fa8f13d78645fd56b /test/test_overflow.c
parent6c31c9d159424d1a6ba2e64b8d271743b9710f32 (diff)
downloadserd-7269c12bbe4532f5f5844aaec16cf1bb75a1c71c.tar.gz
serd-7269c12bbe4532f5f5844aaec16cf1bb75a1c71c.tar.bz2
serd-7269c12bbe4532f5f5844aaec16cf1bb75a1c71c.zip
Expand URIs in reader
This expands relative and prefixed URIs in the reader on the stack, rather than passing them to the caller to be dealt with. This pushes these context-full forms to the edge of the system as much as possible to minimise the headaches they can cause. Towards having stricter guarantees about nodes and eliminating the CURIE node type altogether.
Diffstat (limited to 'test/test_overflow.c')
-rw-r--r--test/test_overflow.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/test/test_overflow.c b/test/test_overflow.c
index 7f08112d..02b71008 100644
--- a/test/test_overflow.c
+++ b/test/test_overflow.c
@@ -21,7 +21,7 @@
#include <assert.h>
#include <stdio.h>
-static const size_t min_stack_size = 4 * sizeof(size_t) + 256u;
+static const size_t min_stack_size = 4 * sizeof(size_t) + 230u;
static const size_t max_stack_size = 1024u;
static SerdStatus
@@ -90,11 +90,9 @@ static void
test_turtle_overflow(void)
{
static const char* const test_strings[] = {
- "<http://example.org/s> <http://example.org/p> :%99 .",
"<http://example.org/s> <http://example.org/p> <http://example.org/> .",
"<http://example.org/s> <http://example.org/p> "
"<thisisanabsurdlylongurischeme://because/testing/> .",
- "<http://example.org/s> <http://example.org/p> eg:foo .",
"<http://example.org/s> <http://example.org/p> 1234 .",
"<http://example.org/s> <http://example.org/p> (1 2 3 4) .",
"<http://example.org/s> <http://example.org/p> (((((((42))))))) .",
@@ -112,7 +110,41 @@ test_turtle_overflow(void)
"@prefix ug.dot: <http://example.org/> . \nug.dot:s ug.dot:p ug.dot:o .\n",
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
- "@prefix øøøøøøøøø: <http://example.org/long> . \n"
+ "<http://example.org/subject/with/a/long/path> "
+ "<http://example.org/predicate/with/a/long/path> "
+ "<http://example.org/object/with/a/long/path> .",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "<http://example.org/s> <http://example.org/p> "
+ "\"typed\"^^<http://example.org/Datatype> .",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix eg: <http://example.org/ns/test> .\n"
+ "<http://example.org/s> <http://example.org/p> "
+ "\"typed\"^^eg:Datatype .",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix eg: <http://example.org/ns/test> .\n"
+ "<http://example.org/s> <http://example.org/p> eg:foo .",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix prefix: <http://example.org/testing/curies> .\n"
+ "prefix:subject prefix:predicate prefix:object .\n",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix eg: <http://example.org/> .\n"
+ "eg:s eg:p [ eg:p [ eg:p [ eg:p [ eg:p []]]]] .\n",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix eg: <http://example.org/> .\n"
+ "eg:s eg:p ( 1 2 3 ( 4 5 6 ( 7 8 9 ) ) ) .\n",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix eg: <http://example.org/ns/test> .\n"
+ "<http://example.org/s> <http://example.org/p> eg:%99 .",
+
+ // NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
+ "@prefix øøøøøøøøø: <http://example.org/long> .\n"
"<http://example.org/somewhatlongsubjecttooffsetthepredicate> øøøøøøøøø:p "
"øøøøøøøøø:o .\n",
@@ -140,8 +172,8 @@ test_turtle_overflow(void)
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
"@prefix prefix: <http://example.org/testing/curies> .\n"
- "prefix:subjectthatwillcomearoundtobeingfinishedanycharacternow "
- "prefix:predicate prefix:object .\n",
+ "<http://example.org/very/long/uri/subject/to/overflow/the/predicate> "
+ "prefix:predicate prefix:object ; prefix:p prefix:o .\n",
// NOLINTNEXTLINE(bugprone-suspicious-missing-comma)
"@prefix eg: <http://example.org/> .\n"