@Test public void clear() throws Exception {

    IntStack stack = new IntStack(1);
    stack.push(1);
    assertThat(stack.peek(), is(1));
    assertThat(stack.size(), is(1));
    stack.push(2);
    assertThat(stack.peek(), is(2));
    assertThat(stack.size(), is(2));
    stack.push(4);
    assertThat(stack.peek(), is(4));
    assertThat(stack.size(), is(3));
    stack.clear();
    assertThat(stack.size(), is(0));
    stack.push(4);
    assertThat(stack.peek(), is(4));
    assertThat(stack.size(), is(1));
    stack.push(8);
    assertThat(stack.peek(), is(8));
    assertThat(stack.size(), is(2));
    stack.push(9);
    assertThat(stack.peek(), is(9));
    assertThat(stack.size(), is(3));
}