Skip to content

Commit

Permalink
Unit tests improved
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejSlamecka committed Apr 12, 2013
1 parent d4da5aa commit d9f4813
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion unittest/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ int main(void)
removeChild(r2->parentNode, r2);
assert("Remove child - body is empty", html->lastChild->firstChild == NULL && html->lastChild->lastChild == NULL);

appendChild(html->lastChild, r1);
appendChild(html->lastChild, r2);
appendChild(html->lastChild, r3);

removeChild(r2->parentNode, r2);
assert("Remove the middle child - relation between first and last",
html->lastChild->firstChild->nextSibling == html->lastChild->lastChild &&
html->lastChild->firstChild == html->lastChild->lastChild->previousSibling);

removeChild(html->lastChild, r1);
removeChild(html->lastChild, r3);

// insertBefore
appendChild(html->lastChild, r3);
Expand All @@ -93,6 +104,9 @@ int main(void)
appendChild(t1, t2);
appendChild(r2, t3);

element *c0 = cloneNode(t2, false);
insertBefore(r2, c0, t3);

element *c1 = cloneNode(r2, true);
element *c2 = cloneNode(r2, false);
appendChild(html->lastChild, c1);
Expand All @@ -107,10 +121,11 @@ int main(void)
&& html->lastChild->firstChild->nextSibling->lastChild != NULL); // html body r2 t3

deleteElement(r1);
deleteElement(r2);
//deleteElement(r2);
deleteElement(r3);

deleteElement(html);

return 0;
}

0 comments on commit d9f4813

Please sign in to comment.