From 8d9b0f60871f29dbb2041d2237730d53d47074bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonathan=20Sch=C3=B6bel?= <jonathan@xn--schbel-yxa.info>
Date: Mon, 20 Mar 2023 10:57:34 +0100
Subject: [PATCH] NodeFragment: revised tests

---
 sefht.geany                |   4 +-
 tests/test_node_fragment.c | 478 +++++++++++++++++++++++--------------
 2 files changed, 301 insertions(+), 181 deletions(-)

diff --git a/sefht.geany b/sefht.geany
index 8b5d69b..a5b9cda 100644
--- a/sefht.geany
+++ b/sefht.geany
@@ -28,7 +28,7 @@ long_line_behaviour=1
 long_line_column=72
 
 [files]
-current_page=16
+current_page=31
 FILE_NAME_0=923;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fconfigure.ac;0;8
 FILE_NAME_1=73;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2FMakefile.am;0;8
 FILE_NAME_2=1143;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fmain.c;0;8
@@ -60,7 +60,7 @@ FILE_NAME_27=1078;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fp
 FILE_NAME_28=533;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
 FILE_NAME_29=1085;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_cms.c;0;8
 FILE_NAME_30=3283;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_data.c;0;8
-FILE_NAME_31=8770;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_node_fragment.c;0;8
+FILE_NAME_31=53849;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_node_fragment.c;0;8
 FILE_NAME_32=12246;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_attr.c;0;8
 FILE_NAME_33=11068;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text.c;0;8
 FILE_NAME_34=5744;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8
diff --git a/tests/test_node_fragment.c b/tests/test_node_fragment.c
index f89cfaa..3cd1048 100644
--- a/tests/test_node_fragment.c
+++ b/tests/test_node_fragment.c
@@ -32,257 +32,349 @@
 #include "node_fragment.c"
 
 
-START_TEST(test_node_fragment)
+START_TEST(test_node_fragment_no_status)
 {
-	struct SH_Status status;
-	struct SH_Fragment * fragment;
-	struct SH_Data * data;
+	struct SH_NodeFragment * fragment;
+	SH_Data * data;
 	const char * tag = "tag";
 
 	data = SH_Data_new (NULL);
 
-	/* valid tag - no error */
-	fragment = SH_NodeFragment_new (tag, data, NULL);
-	ck_assert_int_ne ((long int) fragment, (long int) NULL);
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_new (tag, data, NULL);
 
-	ck_assert_ptr_eq (NULL, fragment->parent);
-	ck_assert_str_eq (((struct SH_NodeFragment *) fragment)->tag, tag);
+	ck_assert_ptr_ne (NULL, fragment);
 
-	SH_Fragment_free (fragment);
+	ck_assert_ptr_eq (NULL, fragment->base.parent);
+	ck_assert_str_eq (fragment->tag, tag);
+
+	ck_assert_int_eq (0, fragment->child_n);
+	ck_assert_int_eq (0, fragment->child_s);
+
+	SH_NodeFragment_free (fragment);
+
+	SH_Data_free (data);
+}
+END_TEST
+
+START_TEST(test_node_fragment_with_status)
+{
+	struct SH_Status status;
+	struct SH_NodeFragment * fragment;
+	SH_Data * data;
+	const char * tag = "tag";
+
+	data = SH_Data_new (NULL);
 
-	/* valid tag - error */
 	_status_preinit (status);
-	fragment = SH_NodeFragment_new (tag, data, &status);
-	ck_assert_int_ne ((long int) fragment, (long int) NULL);
-	ck_assert_int_eq (status.status, SUCCESS);
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_new (tag, data, &status);
 
-	ck_assert_ptr_eq (NULL, fragment->parent);
-	ck_assert_str_eq (((struct SH_NodeFragment *) fragment)->tag, tag);
+	ck_assert_ptr_ne (NULL, fragment);
+	ck_assert (succeed (&status));
 
-	SH_Fragment_free (fragment);
+	ck_assert_ptr_eq (NULL, fragment->base.parent);
+	ck_assert_str_eq (fragment->tag, tag);
+
+	ck_assert_int_eq (0, fragment->child_n);
+	ck_assert_int_eq (0, fragment->child_s);
+
+	SH_NodeFragment_free (fragment);
 
 	SH_Data_free (data);
 }
 END_TEST
 
-START_TEST(test_node_fragment_raw_new)
+START_TEST(test_node_fragment_raw_no_status)
 {
-	struct SH_Status status;
-	struct SH_Fragment * fragment;
-	struct SH_Data * data;
-	char * tag1 = strdup ("tag");
-	char * tag2 = strdup ("tag");
+	struct SH_NodeFragment * fragment;
+	SH_Data * data;
+	char * tag = strdup ("tag");
 
 	data = SH_Data_new (NULL);
 
-	/* valid tag - no error */
-	fragment = SH_NodeFragment_raw_new (tag1, data, NULL);
-	ck_assert_int_ne ((long int) fragment, (long int) NULL);
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_raw_new (tag, data, NULL);
 
-	ck_assert_ptr_eq (NULL, fragment->parent);
-	ck_assert_ptr_eq (((struct SH_NodeFragment *) fragment)->tag, tag1);
+	ck_assert_ptr_ne (NULL, fragment);
 
-	SH_Fragment_free (fragment);
+	ck_assert_ptr_eq (NULL, fragment->base.parent);
+	ck_assert_ptr_eq (fragment->tag, tag);
+
+	ck_assert_int_eq (0, fragment->child_n);
+	ck_assert_int_eq (0, fragment->child_s);
+
+	SH_NodeFragment_free (fragment);
+
+	SH_Data_free (data);
+}
+END_TEST
+
+START_TEST(test_node_fragment_raw_with_status)
+{
+	struct SH_Status status;
+	struct SH_NodeFragment * fragment;
+	SH_Data * data;
+	char * tag = strdup ("tag");
+
+	data = SH_Data_new (NULL);
 
-	/* valid tag - error */
 	_status_preinit (status);
-	fragment = SH_NodeFragment_raw_new (tag2, data, &status);
-	ck_assert_int_ne ((long int) fragment, (long int) NULL);
-	ck_assert_int_eq (status.status, SUCCESS);
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_raw_new (tag, data, &status);
 
-	ck_assert_ptr_eq (NULL, fragment->parent);
-	ck_assert_ptr_eq (((struct SH_NodeFragment *) fragment)->tag, tag2);
+	ck_assert_ptr_ne (NULL, fragment);
+	ck_assert (succeed (&status));
 
-	SH_Fragment_free (fragment);
+	ck_assert_ptr_eq (NULL, fragment->base.parent);
+	ck_assert_ptr_eq (fragment->tag, tag);
+
+	ck_assert_int_eq (0, fragment->child_n);
+	ck_assert_int_eq (0, fragment->child_s);
+
+	SH_NodeFragment_free (fragment);
 
 	SH_Data_free (data);
 }
 END_TEST
 
-START_TEST(test_node_fragment_copy)
+START_TEST(test_node_fragment_copy_no_status)
 {
-	struct SH_Status status;
-	struct SH_Fragment * fragment;
-	struct SH_Fragment * copy;
-	struct SH_Data * data;
+	struct SH_NodeFragment * fragment;
+	struct SH_NodeFragment * copy;
+	SH_Data * data;
 
 	data = SH_Data_new (NULL);
 
-	fragment = SH_NodeFragment_new ("html", data, NULL);
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_new ("html", data, NULL);
 
-	/* without error */
-	copy = SH_NodeFragment_copy (((struct SH_NodeFragment *) fragment),
-				     NULL);
+	copy = (struct SH_NodeFragment *)
+	       SH_NodeFragment_copy (fragment, NULL);
 
 	ck_assert_ptr_ne (copy, NULL);
 	ck_assert_ptr_ne (fragment, copy);
-	ck_assert_ptr_eq (NULL, copy->parent);
-	ck_assert_str_eq (((struct SH_NodeFragment *) fragment)->tag,
-			  ((struct SH_NodeFragment *) copy)->tag);
-	ck_assert_int_eq (((struct SH_NodeFragment *) copy)->child_n, 0);
-	ck_assert_ptr_ne (((struct SH_NodeFragment *) fragment)->childs,
-			  ((struct SH_NodeFragment *) copy)->childs);
+	ck_assert_ptr_eq (NULL, copy->base.parent);
+	ck_assert_str_eq (fragment->tag, copy->tag);
+	ck_assert_int_eq (0, copy->child_n);
+	ck_assert_int_eq (0, copy->child_s);
+	ck_assert_ptr_ne (NULL, copy->childs);
 
-	SH_Fragment_free (copy);
+	SH_NodeFragment_free (fragment);
+	SH_NodeFragment_free (copy);
+
+	SH_Data_free (data);
+}
+END_TEST
+
+START_TEST(test_node_fragment_copy_with_status)
+{
+	struct SH_Status status;
+	struct SH_NodeFragment * fragment;
+	struct SH_NodeFragment * copy;
+	SH_Data * data;
+
+	data = SH_Data_new (NULL);
+
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_new ("html", data, NULL);
 
-	/* with error */
 	_status_preinit (status);
-	copy = SH_NodeFragment_copy (((struct SH_NodeFragment *) fragment),
-				     &status);
-	ck_assert_int_eq (status.status, SUCCESS);
+	copy = (struct SH_NodeFragment *)
+	       SH_NodeFragment_copy (fragment, &status);
+	ck_assert (succeed (&status));
 
 	ck_assert_ptr_ne (copy, NULL);
 	ck_assert_ptr_ne (fragment, copy);
-	ck_assert_ptr_eq (NULL, copy->parent);
-	ck_assert_str_eq (((struct SH_NodeFragment *) fragment)->tag,
-			  ((struct SH_NodeFragment *) copy)->tag);
-	ck_assert_int_eq (((struct SH_NodeFragment *) copy)->child_n, 0);
-	ck_assert_ptr_ne (((struct SH_NodeFragment *) fragment)->childs,
-			  ((struct SH_NodeFragment *) copy)->childs);
+	ck_assert_ptr_eq (NULL, copy->base.parent);
+	ck_assert_str_eq (fragment->tag, copy->tag);
+	ck_assert_int_eq (0, copy->child_n);
+	ck_assert_int_eq (0, copy->child_s);
+	ck_assert_ptr_ne (NULL, copy->childs);
 
-	SH_Fragment_free (fragment);
-	SH_Fragment_free (copy);
+	SH_NodeFragment_free (fragment);
+	SH_NodeFragment_free (copy);
 
 	SH_Data_free (data);
 }
 END_TEST
 
 static void
-check_childs (struct SH_NodeFragment * fragment, struct SH_NodeFragment * copy)
+check_childs (struct SH_NodeFragment * fragment,
+              struct SH_NodeFragment * copy)
 {
 	size_t index;
 
+	ck_assert_str_eq (fragment->tag, copy->tag);
+	ck_assert_int_eq (fragment->child_n, copy->child_n);
+	ck_assert_int_eq (fragment->child_s, copy->child_s);
+	ck_assert_ptr_ne (fragment->childs, copy->childs);
+
 	for (index = 0; index < copy->child_n; index++)
 	{
 		ck_assert_ptr_ne (fragment->childs[index],
 				  copy->childs[index]);
 		ck_assert_ptr_eq (copy, get_parent (copy->childs[index]));
-		ck_assert_str_eq (((struct SH_NodeFragment *) fragment->childs[index])->tag,
-				  ((struct SH_NodeFragment *) copy->childs[index])->tag);
-		ck_assert_int_eq (((struct SH_NodeFragment *) fragment->childs[index])->child_n,
-				  ((struct SH_NodeFragment *) copy->childs[index])->child_n);
 
-		check_childs (((struct SH_NodeFragment *) fragment->childs[index]),
-			      ((struct SH_NodeFragment *) copy->childs[index]));
+		check_childs (((struct SH_NodeFragment *)
+		              fragment->childs[index]),
+			      ((struct SH_NodeFragment *)
+			      copy->childs[index]));
 	}
 
 	return;
 }
 
-START_TEST(test_node_fragment_deepcopy)
+START_TEST(test_node_fragment_deepcopy_no_status)
 {
-	struct SH_Status status;
-	struct SH_Fragment * fragment;
+	struct SH_NodeFragment * fragment;
+	struct SH_NodeFragment * copy;
 	struct SH_Fragment * child1;
 	struct SH_Fragment * child2;
-	struct SH_Fragment * copy;
-	struct SH_Data * data;
+	SH_Data * data;
 
 	data = SH_Data_new (NULL);
 
-	fragment = SH_NodeFragment_new ("html", data, NULL);
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_new ("html", data, NULL);
 
 	child1 = SH_NodeFragment_new ("head", data, NULL);
-	SH_NodeFragment_append_child (((struct SH_NodeFragment *) fragment),
-				      child1, NULL);
+	SH_NodeFragment_append_child (fragment, child1, NULL);
 
 	child2 = SH_NodeFragment_new ("title", data, NULL);
-	SH_NodeFragment_append_child (((struct SH_NodeFragment *) child1),
-				      child2, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
 
 
 	child1 = SH_NodeFragment_new ("body", data, NULL);
-	SH_NodeFragment_append_child (((struct SH_NodeFragment *) fragment),
-				      child1, NULL);
+	SH_NodeFragment_append_child (fragment, child1, NULL);
 
 	child2 = SH_NodeFragment_new ("header", data, NULL);
-	SH_NodeFragment_append_child (((struct SH_NodeFragment *) child1),
-				      child2, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
 
 	child2 = SH_NodeFragment_new ("main", data, NULL);
-	SH_NodeFragment_append_child (((struct SH_NodeFragment *) child1),
-				      child2, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
 
 	child2 = SH_NodeFragment_new ("footer", data, NULL);
-	SH_NodeFragment_append_child (((struct SH_NodeFragment *) child1),
-				      child2, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
 
 
-	/* without error */
-	copy = SH_Fragment_copy (fragment, NULL);
+	copy = (struct SH_NodeFragment *)
+	       SH_NodeFragment_deepcopy (fragment, NULL);
 
-	ck_assert_ptr_ne (copy, NULL);
+	ck_assert_ptr_ne (NULL, copy);
 	ck_assert_ptr_ne (fragment, copy);
-	ck_assert_ptr_eq (NULL, copy->parent);
-	ck_assert_str_eq (((struct SH_NodeFragment *) fragment)->tag,
-			  ((struct SH_NodeFragment *) copy)->tag);
-	ck_assert_int_eq (((struct SH_NodeFragment *) fragment)->child_n,
-			  ((struct SH_NodeFragment *) copy)->child_n);
-	ck_assert_ptr_ne (((struct SH_NodeFragment *) fragment)->childs,
-			  ((struct SH_NodeFragment *) copy)->childs);
+	ck_assert_ptr_eq (NULL, copy->base.parent);
 
-	check_childs (((struct SH_NodeFragment *) fragment),
-		      ((struct SH_NodeFragment *) copy));
+	check_childs (fragment, copy);
+
+	SH_NodeFragment_free (fragment);
+	SH_NodeFragment_free (copy);
+
+	SH_Data_free (data);
+}
+END_TEST
+
+START_TEST(test_node_fragment_deepcopy_with_status)
+{
+	struct SH_Status status;
+	struct SH_NodeFragment * fragment;
+	struct SH_NodeFragment * copy;
+	struct SH_Fragment * child1;
+	struct SH_Fragment * child2;
+	SH_Data * data;
+
+	data = SH_Data_new (NULL);
+
+	fragment = (struct SH_NodeFragment *)
+	           SH_NodeFragment_new ("html", data, NULL);
+
+	child1 = SH_NodeFragment_new ("head", data, NULL);
+	SH_NodeFragment_append_child (fragment, child1, NULL);
+
+	child2 = SH_NodeFragment_new ("title", data, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
+
+
+	child1 = SH_NodeFragment_new ("body", data, NULL);
+	SH_NodeFragment_append_child (fragment, child1, NULL);
+
+	child2 = SH_NodeFragment_new ("header", data, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
+
+	child2 = SH_NodeFragment_new ("main", data, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
+
+	child2 = SH_NodeFragment_new ("footer", data, NULL);
+	SH_NodeFragment_append_child ((struct SH_NodeFragment *)child1,
+	                              child2, NULL);
 
-	SH_Fragment_free (copy);
 
-	/* with error */
 	_status_preinit (status);
-	copy = SH_Fragment_copy (fragment, &status);
-	ck_assert_int_eq (status.status, SUCCESS);
+	copy = (struct SH_NodeFragment *)
+	       SH_NodeFragment_deepcopy (fragment, &status);
+	ck_assert (succeed (&status));
 
-	ck_assert_ptr_ne (copy, NULL);
+	ck_assert_ptr_ne (NULL, copy);
 	ck_assert_ptr_ne (fragment, copy);
-	ck_assert_ptr_eq (NULL, copy->parent);
-	ck_assert_str_eq (((struct SH_NodeFragment *) fragment)->tag,
-			  ((struct SH_NodeFragment *) copy)->tag);
-	ck_assert_int_eq (((struct SH_NodeFragment *) fragment)->child_n,
-			  ((struct SH_NodeFragment *) copy)->child_n);
-	ck_assert_ptr_ne (((struct SH_NodeFragment *) fragment)->childs,
-			  ((struct SH_NodeFragment *) copy)->childs);
+	ck_assert_ptr_eq (NULL, copy->base.parent);
 
-	check_childs (((struct SH_NodeFragment *) fragment),
-		      ((struct SH_NodeFragment *) copy));
+	check_childs (fragment, copy);
 
-	SH_Fragment_free (fragment);
-	SH_Fragment_free (copy);
+	SH_NodeFragment_free (fragment);
+	SH_NodeFragment_free (copy);
 
 	SH_Data_free (data);
 }
 END_TEST
 
-START_TEST(test_node_fragment_tag)
+START_TEST(test_node_fragment_tag_no_status)
 {
-	struct SH_Status status;
 	struct SH_Fragment * fragment;
-	struct SH_Data * data;
+	SH_Data * data;
 	char * tag;
 	const char * tag1 = "html";
-	const char * tag2 = "body";
 
 	data = SH_Data_new (NULL);
 
 	/* no error */
 	fragment = SH_NodeFragment_new (tag1, data, NULL);
 
-	tag = SH_NodeFragment_raw_get_tag (((struct SH_NodeFragment *) fragment));
-	ck_assert_str_eq (tag, tag1);
-
-	tag = SH_NodeFragment_get_tag (((struct SH_NodeFragment *) fragment),
-				       NULL);
+	tag = SH_NodeFragment_get_tag ((struct SH_NodeFragment *)
+	                               fragment,
+	                               NULL);
 	ck_assert_str_eq (tag, tag1);
 	free (tag);
 
 	SH_Fragment_free (fragment);
+	SH_Data_free (data);
+}
+END_TEST
 
-	/* error */
-	fragment = SH_NodeFragment_new (tag2, data, NULL);
+START_TEST(test_node_fragment_tag_with_status)
+{
+	struct SH_Status status;
+	struct SH_Fragment * fragment;
+	SH_Data * data;
+	char * tag;
+	const char * tag1 = "html";
+
+	data = SH_Data_new (NULL);
+
+	fragment = SH_NodeFragment_new (tag1, data, NULL);
 
 	_status_preinit (status);
-	tag = SH_NodeFragment_get_tag (((struct SH_NodeFragment *) fragment),
-				       &status);
-	ck_assert_str_eq (tag, tag2);
-	ck_assert_int_eq (status.status, SUCCESS);
+	tag = SH_NodeFragment_get_tag ((struct SH_NodeFragment *)
+	                               fragment,
+	                               &status);
+	ck_assert_str_eq (tag, tag1);
+	ck_assert (succeed (&status));
 	free (tag);
 
 	SH_Fragment_free (fragment);
@@ -290,17 +382,39 @@ START_TEST(test_node_fragment_tag)
 }
 END_TEST
 
+START_TEST(test_node_fragment_tag_raw)
+{
+	struct SH_Fragment * fragment;
+	SH_Data * data;
+	char * tag;
+	const char * tag1 = "html";
+
+	data = SH_Data_new (NULL);
+
+	fragment = SH_NodeFragment_new (tag1, data, NULL);
+
+	tag = SH_NodeFragment_raw_get_tag (((struct SH_NodeFragment *)
+	                                   fragment));
+	ck_assert_str_eq (tag, tag1);
+
+	SH_Fragment_free (fragment);
+	SH_Data_free (data);
+}
+END_TEST
+
 START_TEST(test_node_fragment_child_alloc)
 {
-	ck_assert_int_eq (0, get_child_alloc_size (0));
-	ck_assert_int_eq (CHILD_CHUNK, get_child_alloc_size (1));
-	ck_assert_int_eq (CHILD_CHUNK, get_child_alloc_size (CHILD_CHUNK));
-	ck_assert_int_eq (2*CHILD_CHUNK, get_child_alloc_size (CHILD_CHUNK+1));
-	ck_assert_int_eq (SIZE_MAX, get_child_alloc_size (SIZE_MAX));
+	#define alloc_size get_child_alloc_size
+	ck_assert_int_eq (0, alloc_size (0));
+	ck_assert_int_eq (CHILD_CHUNK, alloc_size (1));
+	ck_assert_int_eq (CHILD_CHUNK, alloc_size (CHILD_CHUNK));
+	ck_assert_int_eq (2*CHILD_CHUNK, alloc_size (CHILD_CHUNK+1));
+	ck_assert_int_eq (SIZE_MAX, alloc_size (SIZE_MAX));
 	for (size_t i = 0; i < CHILD_CHUNK; i++)
 	{
-		ck_assert_int_le (SIZE_MAX-i, get_child_alloc_size (SIZE_MAX-i));
+		ck_assert_int_le (SIZE_MAX-i, alloc_size (SIZE_MAX-i));
 	}
+	#undef alloc_size
 }
 END_TEST
 
@@ -586,7 +700,7 @@ START_TEST(test_node_fragment_is_ancestor)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_insert_no_error)
+START_TEST(test_node_fragment_child_insert_no_status)
 {
 	SH_Data * data;
 	struct SH_NodeFragment * parent;
@@ -669,7 +783,7 @@ START_TEST(test_node_fragment_child_insert_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_insert_with_error)
+START_TEST(test_node_fragment_child_insert_with_status)
 {
 	struct SH_Status status;
 	SH_Data * data;
@@ -767,7 +881,7 @@ START_TEST(test_node_fragment_child_insert_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_insert_insert_no_error)
+START_TEST(test_node_fragment_child_insert_insert_no_status)
 {
 	struct SH_NodeFragment * parent;
 	struct SH_Fragment * child1;
@@ -812,7 +926,7 @@ START_TEST(test_node_fragment_child_insert_insert_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_insert_insert_with_error)
+START_TEST(test_node_fragment_child_insert_insert_with_status)
 {
 	struct SH_Status status;
 	struct SH_NodeFragment * parent;
@@ -871,7 +985,7 @@ START_TEST(test_node_fragment_child_insert_insert_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_insert_relative_no_error)
+START_TEST(test_node_fragment_child_insert_relative_no_status)
 {
 	struct SH_NodeFragment * parent;
 	struct SH_Fragment * child1;
@@ -935,7 +1049,7 @@ START_TEST(test_node_fragment_child_insert_relative_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_insert_relative_with_error)
+START_TEST(test_node_fragment_child_insert_relative_with_status)
 {
 	struct SH_Status status;
 	struct SH_NodeFragment * parent;
@@ -1018,7 +1132,7 @@ START_TEST(test_node_fragment_child_insert_relative_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_no_error)
+START_TEST(test_node_fragment_child_remove_no_status)
 {
 	struct SH_NodeFragment * parent;
 	struct SH_Fragment * child;
@@ -1119,7 +1233,7 @@ START_TEST(test_node_fragment_child_remove_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_with_error)
+START_TEST(test_node_fragment_child_remove_with_status)
 {
 	struct SH_Status status;
 	struct SH_NodeFragment * parent;
@@ -1233,7 +1347,7 @@ START_TEST(test_node_fragment_child_remove_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_remove_self_no_error)
+START_TEST(test_node_fragment_child_remove_remove_self_no_status)
 {
 	struct SH_Fragment * parent;
 	struct SH_Fragment * child;
@@ -1269,7 +1383,7 @@ START_TEST(test_node_fragment_child_remove_remove_self_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_remove_self_with_error)
+START_TEST(test_node_fragment_child_remove_remove_self_with_status)
 {
 	struct SH_Status status;
 	struct SH_Fragment * parent;
@@ -1314,7 +1428,7 @@ START_TEST(test_node_fragment_child_remove_remove_self_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_delete_self_no_error)
+START_TEST(test_node_fragment_child_remove_delete_self_no_status)
 {
 	struct SH_Fragment * parent;
 	struct SH_Fragment * child;
@@ -1350,7 +1464,7 @@ START_TEST(test_node_fragment_child_remove_delete_self_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_delete_self_with_error)
+START_TEST(test_node_fragment_child_remove_delete_self_with_status)
 {
 	struct SH_Status status;
 	struct SH_Fragment * parent;
@@ -1395,7 +1509,7 @@ START_TEST(test_node_fragment_child_remove_delete_self_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_remove_no_error)
+START_TEST(test_node_fragment_child_remove_remove_no_status)
 {
 	struct SH_NodeFragment * parent;
 	struct SH_Fragment * child;
@@ -1425,7 +1539,7 @@ START_TEST(test_node_fragment_child_remove_remove_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_remove_with_error)
+START_TEST(test_node_fragment_child_remove_remove_with_status)
 {
 	struct SH_Status status;
 	struct SH_NodeFragment * parent;
@@ -1461,7 +1575,7 @@ START_TEST(test_node_fragment_child_remove_remove_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_delete_no_error)
+START_TEST(test_node_fragment_child_remove_delete_no_status)
 {
 	struct SH_NodeFragment * parent;
 	struct SH_Fragment * child;
@@ -1490,7 +1604,7 @@ START_TEST(test_node_fragment_child_remove_delete_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_delete_with_error)
+START_TEST(test_node_fragment_child_remove_delete_with_status)
 {
 	struct SH_Status status;
 	struct SH_NodeFragment * parent;
@@ -1525,7 +1639,7 @@ START_TEST(test_node_fragment_child_remove_delete_with_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_pop_no_error)
+START_TEST(test_node_fragment_child_remove_pop_no_status)
 {
 	struct SH_NodeFragment * parent;
 	struct SH_Fragment * child;
@@ -1556,7 +1670,7 @@ START_TEST(test_node_fragment_child_remove_pop_no_error)
 }
 END_TEST
 
-START_TEST(test_node_fragment_child_remove_pop_with_error)
+START_TEST(test_node_fragment_child_remove_pop_with_status)
 {
 	struct SH_Status status;
 	struct SH_NodeFragment * parent;
@@ -1668,11 +1782,17 @@ Suite * fragment_suite (void)
 	/* Core test case */
 	tc_core = tcase_create ("Core");
 
-	tcase_add_test (tc_core, test_node_fragment);
-	tcase_add_test (tc_core, test_node_fragment_raw_new);
-	tcase_add_test (tc_core, test_node_fragment_copy);
-	tcase_add_test (tc_core, test_node_fragment_deepcopy);
-	tcase_add_test (tc_core, test_node_fragment_tag);
+	tcase_add_test (tc_core, test_node_fragment_no_status);
+	tcase_add_test (tc_core, test_node_fragment_with_status);
+	tcase_add_test (tc_core, test_node_fragment_raw_no_status);
+	tcase_add_test (tc_core, test_node_fragment_raw_with_status);
+	tcase_add_test (tc_core, test_node_fragment_copy_no_status);
+	tcase_add_test (tc_core, test_node_fragment_copy_with_status);
+	tcase_add_test (tc_core, test_node_fragment_deepcopy_no_status);
+	tcase_add_test (tc_core, test_node_fragment_deepcopy_with_status);
+	tcase_add_test (tc_core, test_node_fragment_tag_no_status);
+	tcase_add_test (tc_core, test_node_fragment_tag_with_status);
+	tcase_add_test (tc_core, test_node_fragment_tag_raw);
 	tcase_add_test (tc_core, test_node_fragment_child_alloc);
 	tcase_add_test (tc_core, test_node_fragment_child);
 	tcase_add_test (tc_core, test_node_fragment_get_child);
@@ -1680,24 +1800,24 @@ Suite * fragment_suite (void)
 	tcase_add_test (tc_core, test_node_fragment_is_descendant);
 	tcase_add_test (tc_core, test_node_fragment_is_parent);
 	tcase_add_test (tc_core, test_node_fragment_is_ancestor);
-	tcase_add_test (tc_core, test_node_fragment_child_insert_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_insert_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_insert_insert_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_insert_insert_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_insert_relative_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_insert_relative_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_self_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_self_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_self_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_self_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_with_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_pop_no_error);
-	tcase_add_test (tc_core, test_node_fragment_child_remove_pop_with_error);
+	tcase_add_test (tc_core, test_node_fragment_child_insert_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_insert_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_insert_insert_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_insert_insert_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_insert_relative_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_insert_relative_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_self_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_self_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_self_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_self_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_remove_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_delete_with_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_pop_no_status);
+	tcase_add_test (tc_core, test_node_fragment_child_remove_pop_with_status);
 	tcase_add_test (tc_core, test_node_fragment_html);
 	suite_add_tcase (s, tc_core);
 
-- 
GitLab