All pastes #975847 Raw Edit

Mine

public text v1 · immutable
·published 2008-04-07 20:26 UTC
rendered paste body
public class TaskPrioritySequenceTester {
	
	public static void main(String[] args) {
		
		TaskList t = new BrokenPrioritySequence();
		
		
		SimpleDate date1 = new SimpleDate (4, 11, 12);
		SimpleDate date2 = new SimpleDate (4, 11, 14);
		SimpleDate date3 = new SimpleDate (4, 11, 20);
		
		
		Task task1 = new Task ("cut grass");
		Task task2 = new Task ("grocery shopping");
		Task task3 = new Task ("write english paper", date1);
		Task task4 = new Task ("hair cut", date2);
		Task task5 = new Task ("study for CS exam", date3);
		
		//add task then test for correct count and order
		
		if (t.taskCount() != 0) {
			System.out.println("error: task count does not initialize to 0");
			
			t.addTask(task1);
			
			if (t.taskCount()!=1 || t.nextTask()!=task1){
				System.out.print("error on adding first task");
			}
			t.addTask(task2);
			
			if (t.taskCount()!=2 || t.nextTask()!=task2){
				System.out.print("error on adding second task");
			}
			t.addTask(task3);
			
			if (t.taskCount()!=3 || t.nextTask()!=task3){
				System.out.print("error on adding third task");
			}
			t.addTask(task4);
			
			if (t.taskCount()!=4 || t.nextTask()!=task4){
				System.out.print("error on adding fourth task");
			}
			t.addTask(task5);
			
			if (t.taskCount()!=5 || t.nextTask()!=task5){
				System.out.print("error on adding fifth task");
			}
		}
	}
}