4import java.util.NoSuchElementException;
7import static org.junit.Assert.*;
18 assertEquals(stack.
top().intValue(),1);
26 assertTrue(stack.
pop()==3);
27 assertTrue(stack.
pop()==2);
28 assertTrue(stack.
pop()==1);
32 @Test(expected=NoSuchElementException.class)
37 @Test(expected=NoSuchElementException.class)
43 public static void main(String args[]) {
44 org.junit.runner.JUnitCore.main(
"aud.test.StackTest");
Implementation of a stack based on aud.Vector.
void push(T x)
Push x onto stack.
boolean is_empty()
Is stack empty?
T pop()
Pop element from stack.
static void main(String args[])
AuD lecture: Data structures, algorithms, examples.