#include <stdio.h>
#include "cx.h"


intlist int1, int2, int3;


test_intlist()
{
	int1 = intlist_nil();
	int2 = intlist_cons( 11, int1 );
	int3 = intlist_cons( 20, int2 );

	printf( "intlists:\n" );
	printf( "\n int1: len %d, ", length(int1) );
	print_intlist( stdout, int1 );
	printf( "\n int2: len %d, ", length(int2) );
	print_intlist( stdout, int2 );
	printf( "\n int3: len %d, ", length(int3) );
	print_intlist( stdout, int3 );
	printf( "\n\n" );
}


test_illist()
{
	illist  il1, il2, il3, il4;

	il1 = illist_nil();
	il2 = illist_cons( int1, il1 );
	il3 = illist_cons( int2, il2 );
	il4 = illist_cons( int3, il3 );

	printf( "illists:\n" );
	printf( "\n il1: len %d, ", length(il1) ); print_illist( stdout, il1 );
	printf( "\n il2: len %d, ", length(il2) ); print_illist( stdout, il2 );
	printf( "\n il3: len %d, ", length(il2) ); print_illist( stdout, il3 );
	printf( "\n il4: len %d, ", length(il2) ); print_illist( stdout, il4 );
	printf( "\n\n" );
}


test_idtree()
{
	idtree	id1, id2, id3, id4, id5, id6;

	id1 = idtree_leaf( "hello", int1 );
	id2 = idtree_leaf( "there", int2 );
	id3 = idtree_node( id1, id2 );
	id4 = idtree_node( id3, id1 );
	id5 = idtree_leaf( "zebedee", int3 );
	id6 = idtree_node( id4, id5 );

	printf( "idtrees:\n" );
	printf( "\n id1: " ); print_idtree( stdout, id1 );
	printf( "\n id2: " ); print_idtree( stdout, id2 );
	printf( "\n id3: " ); print_idtree( stdout, id3 );
	printf( "\n id4: " ); print_idtree( stdout, id4 );
	printf( "\n id5: " ); print_idtree( stdout, id5 );
	printf( "\n id6: " ); print_idtree( stdout, id6 );
	printf( "\n\n" );
}


main()
{
	init_cx();
	test_intlist();
	test_illist();
	test_idtree();
}
