@Test
 public void testMarkReset()
	throws IOException
 {
  for (int i = 0; i < samples.length; i++)
  {
   ByteArrayInputStream sample = samples[i];
   RepeatableByteSource source = new ByteInputStream(sample, BUFFER_SIZE);
   source.mark(0);
   int pos = SIZES[i];
   if (BUFFER_SIZE - 2 < pos)
    pos = BUFFER_SIZE - 2;
   if (0 > --pos) pos = 0;
   source.skipBytes(pos);
   if (SIZES[i] > pos)
    assertEquals("byte read at position " + pos, (byte)pos, source.readByte());
   source.reset();
   if (0 == SIZES[i])
    assertFalse("empty stream reports hasData() after reset", source.hasData());
   else
   {
    for (pos = 0; SIZES[i] >> 1 >= pos; pos++)
     assertEquals("byte read at position " + pos + " after reset", (byte)pos, source.readByte());
    source.mark(0);
    for (int j = pos; SIZES[i] > j; j++)
     assertEquals("byte read at position " + j + " after reset", (byte)j, source.readByte());
    if (SIZES[i] - pos <= BUFFER_SIZE - 2)
    {
     source.reset();
     if (SIZES[i] > pos)
      assertEquals("byte read at position " + pos + " after reset", (byte)pos, source.readByte());
     else
      assertFalse("stream of size " + SIZES[i] + " reports hasData() at position " + pos, source.hasData());
    }
    else
     assertTrue("loss of mark at position " + pos + " not reported at " + SIZES[i], 0 > source.getReadLimit());
   }
  }
 }