#include #include #include #include #include "html.h" #define a(x) if(x) printf("P!\n"); else {printf("F!\n");exit(1);} #define e(x) printf("expecting true on %s:%d\n",__FILE__,__LINE__);a(x) void testtags(){ tag *root=newchild(NULL); tag *a=newchild(root); tag *b=newchild(root); e(nthchild(root,0)==a); e(nthchild(root,1)==b); } void testscripttag(){ tag *root=newchild(NULL); char *testpage="
"; rtag(root,testpage,"!",3,testpage); e(!(nthchildtag(root,1)==NULL)) printf("%s\n",nthchild(root,1)->type); e(!strcmp(nthchildtag(root,1)->type,"script")) e(!strcmp(nthchildtag(root,1)->freetext,"1+1=2;")) } int main() { assert(1+1==2); testtags(); testscripttag(); return 0; }