testiterator.c 856 Bytes
#include <stdio.h>

#include "trbase.h"
#include "trdata.h"

int
main (int argc, char * argv[])
{
	TR_List  list  = TR_new(TR_List);
	TR_Queue queue = TR_new(TR_Queue);

	list->free_msgs = 0;
	((TR_List)queue)->free_msgs = 0;

	TR_listPut(list, "a");
	TR_listPut(list, "b");
	TR_listPut(list, "c");

	TR_iterableForeach(list) {
		printf("%s\n", (char *)TR_iterableCurrent(list));
	}

	TR_listGetFirst(list);

	TR_iterableForeach(list) {
		printf("%s\n", (char *)TR_iterableCurrent(list));
	}

	TR_queuePut(queue, "1");
	TR_queuePut(queue, "2");
	TR_queuePut(queue, "3");

	TR_iterableForeach(queue) {
		printf("%s\n", (char *)TR_iterableCurrent(queue));
	}

	TR_queueGet(queue);

	TR_iterableForeach(queue) {
		printf("%s\n", (char *)TR_iterableCurrent(queue));
	}

	TR_delete(list);
	TR_delete(queue);
	TR_cleanup();

	return 0;
}

// vim: set ts=4 sw=4: