import static java.lang.System.out;

/****
 *
 * This is a testing program for the simple implementation in linked-list{h,c}.
 *
 */

public class LinkedListTest {

    /**
     * Print the given list with the given debugging message one line above the
     * list output.
     */
    static void print(LinkedList l, String msg) {
	out.printf("List contents, should be %s\n                         ",
	    msg);
	l.printList();
	out.printf("\n");
    }

    /**
     * Allocate a linked list, insert some values in it, and print it out after
     * each insert.
     */
    public static void main (String args[]) {
	LinkedList l;

	l = new LinkedList();
	print(l, "empty");

	l.insert(new ListNode(0), 0);
	print(l, "0");

	l.insert(new ListNode(1), 1);
	print(l, "0,1");

	l.insert(new ListNode(2), 2);
	print(l, "0,1,2");

	l.insert(new ListNode(3), 3);
	print(l, "0,1,2,3");

	l.insert(new ListNode(-1), 0);
	print(l, "-1,0,1,2,3");

	l.insert(new ListNode(10), 3);
	print(l, "-1,0,1,10,2,3");

	l.insert(new ListNode(100), 6);
	print(l, "-1,0,1,10,2,3,100");

	l.insert(new ListNode(100), l.length+1);
	print(l, "-1,0,1,10,2,3,100");

	l.insert(new ListNode(100), -1);
	print(l, "-1,0,1,10,2,3,100");

    }

}