-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayQueueTest.java
More file actions
29 lines (26 loc) · 618 Bytes
/
Copy pathArrayQueueTest.java
File metadata and controls
29 lines (26 loc) · 618 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class ArrayQueueTest {
public static void main(String[] args){
ArrayQueue testCirc = new ArrayQueue(10);
String[] test = {"a","b","c","d","e"};
for(String s : test){
testCirc.enqueue(s);
}
for(int i = 0; i<1000; i++){
try{
testCirc.enqueue(testCirc.dequeue());
} catch(Exception e){
System.err.println("Circularity has caused an error");
return;
}
}
if(testCirc.dequeue()!="a"){
System.err.println("Incorrect dequeue order");
return;
}
if(testCirc.getSize()!=4){
System.err.println("Incorrect size");
return;
}
System.out.println("Success");
}
}