summaryrefslogtreecommitdiff
path: root/test/parse.c
diff options
context:
space:
mode:
authorJesper Jensen <jesper@jnsn.dev>2025-03-29 23:28:17 +0100
committerJesper Jensen <jesper@jnsn.dev>2025-03-29 23:28:17 +0100
commite5a5469c5ea0df72c5e0bb6f742923ba692ea7f8 (patch)
tree35b05814fa6ad8cff9ab5792f0200eec2928607a /test/parse.c
parent3040f7881accffd187b2defdc32d69543f73206d (diff)
Separate the tree expander outHEADmaster
Diffstat (limited to 'test/parse.c')
-rw-r--r--test/parse.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/parse.c b/test/parse.c
index 328bfd3..e1474cd 100644
--- a/test/parse.c
+++ b/test/parse.c
@@ -17,7 +17,7 @@ int main(int argc, char **argv) {
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
if(parse_string("<root></root>", &a, &chunks) != 0) return fail();
if(a.adj.stride != 1) return fail();
if(a.len != 1) return fail();
@@ -28,6 +28,7 @@ int main(int argc, char **argv) {
// Verify chunk offsets
if(chunks[0] != 0) return fail();
+ if(chunks[1] != 6) return fail();
free(chunks);
free(a.adj.data);
@@ -35,7 +36,7 @@ int main(int argc, char **argv) {
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
if(parse_string("<root> </root>", &a, &chunks) != 0) return fail();
if(a.adj.stride != 1) return fail();
if(a.len != 1) return fail();
@@ -46,6 +47,7 @@ int main(int argc, char **argv) {
// Verify chunk offsets
if(chunks[0] != 0) return fail();
+ if(chunks[1] != 7) return fail();
free(chunks);
free(a.adj.data);
@@ -53,7 +55,7 @@ int main(int argc, char **argv) {
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
if(parse_string("<root>\n</root>", &a, &chunks) != 0) return fail();
if(a.adj.stride != 1) return fail();
if(a.len != 1) return fail();
@@ -64,6 +66,7 @@ int main(int argc, char **argv) {
// Verify chunk offsets
if(chunks[0] != 0) return fail();
+ if(chunks[1] != 7) return fail();
free(chunks);
free(a.adj.data);
@@ -71,7 +74,7 @@ int main(int argc, char **argv) {
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
if(parse_string("<root><a></a><b></b></root>", &a, &chunks) != 0) return fail();
if(a.adj.stride != 2) return fail();
if(a.len != 3) return fail();
@@ -85,7 +88,10 @@ int main(int argc, char **argv) {
// Verify chunk offsets
if(chunks[0] != 0) return fail();
if(chunks[1] != 6) return fail();
- if(chunks[2] != 13) return fail();
+ if(chunks[2] != 9) return fail();
+ if(chunks[3] != 13) return fail();
+ if(chunks[4] != 16) return fail();
+ if(chunks[5] != 20) return fail();
free(chunks);
free(a.adj.data);
@@ -93,7 +99,7 @@ int main(int argc, char **argv) {
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
if(parse_string("<root><a><c></c></a><b></b></root>", &a, &chunks) != 0) return fail();
if(a.adj.stride != 2) return fail();
if(a.len != 4) return fail();
@@ -109,7 +115,11 @@ int main(int argc, char **argv) {
if(chunks[0] != 0) return fail();
if(chunks[1] != 6) return fail();
if(chunks[2] != 9) return fail();
- if(chunks[3] != 20) return fail();
+ if(chunks[3] != 12) return fail();
+ if(chunks[4] != 16) return fail();
+ if(chunks[5] != 20) return fail();
+ if(chunks[6] != 23) return fail();
+ if(chunks[7] != 27) return fail();
free(chunks);
free(a.adj.data);
@@ -118,7 +128,7 @@ int main(int argc, char **argv) {
// We forgot to close the open tag
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
fflush(stdout);
if(parse_string("<root</root>", &a, &chunks) != 1) return fail();
fflush(stdout);
@@ -127,7 +137,7 @@ int main(int argc, char **argv) {
// Test self-closing tag
{
struct Tree a;
- size_t *chunks = NULL;
+ ssize_t *chunks = NULL;
fflush(stdout);
if(parse_string("<root><a /></root>", &a, &chunks) != 0) return fail();
if(a.adj.stride != 1) return fail();
@@ -141,6 +151,8 @@ int main(int argc, char **argv) {
// Verify chunk offsets
if(chunks[0] != 0) return fail();
if(chunks[1] != 6) return fail();
+ if(chunks[2] != 9) return fail();
+ if(chunks[3] != 11) return fail();
free(chunks);
free(a.adj.data);