Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#Actualfrob

Posted 07 September 2013 - 12:21 AM

After reading that a few times, it looks like you have a unit test for the buffers, and an acceptance test / integration test for the archiving system as a whole.

For the buffering system, I would think this kind of test would work for the problem you described:
[TestFixture]
public class BufferedOutputStreamShould {
  [Test]
  public void StoreMaxBytesWithoutFlushing() {...}
  [Test]
  public void StoreMaxPlusOneBytesWithFlushing_AndLeaveOneByteBuffered() {...}
  [Test]
  public void BeEmptyAfterAddingOneByteAndFlushing() {...}
}
These things could be testable by exposing the maximum number of bytes that can be buffered and the bytes still in the buffer. Neither requires great insights into the details, and you can modify the actual number of bytes later without changing the interface. Simple functions like GetBufferTotalSize() and GetBufferRemaining() should suffice, no need for friends.

This should address your concerns about it dumping the data before it is completely full, and verify that buffering is dumping the data when it becomes exactly full.


The archiving system as a whole can operate without regard to buffering. Here's the things I would expect in the integration tests:

[TestFixture]
public class ArchivingSystemShould  {
  [Test]
  public void GiveIdenticalFooAfterSaveLoad() {...}
  [Test]
  public void GiveIdenticalBarAfterSaveLoad() {...}
  [Test]
  public void HandleBatchOfFiftyLoadSave() {...}
}
Is that about it?

: The editor ate my formatting...


#1frob

Posted 07 September 2013 - 12:13 AM

After reading that a few times, it looks like you have a unit test for the buffers, and an acceptance test / integration test for the archiving system as a whole.

For the buffering system, I would think this kind of test would work for the problem you described:
[TestFixture]
public class BufferedOutputStreamShould {
  [Test]  public void StoreMaxBytesWithoutFlushing() {...}
  [Test]  public void StoreMaxPlusOneBytesWithFlushing_AndStillHaveOneByteBuffered() {...}
  [Test]  public void BeEmptyAfterAddingOneByteAndFlushing() {...}
}
These things could be testable by exposing the maximum number of bytes that can be buffered and the bytes still in the buffer. Neither requires great insights into the details, and you can modify the actual number of bytes later without changing the interface. Simple functions like GetBufferTotalSize() and GetBufferRemaining() should suffice, no need for friends.

This should address your concerns about it dumping the data before it is completely full, and verify that buffering is dumping the data when it becomes exactly full.


The archiving system as a whole can operate without regard to buffering. Here's the things I would expect in the integration tests:

[TestFixture]
public class ArchivingSystemShould  {
  [Test]  public void BeIdenticalAfterLoadSave() {...}
  [Test]  public void ProcessFooLoadSave() {...}
  [Test]  public void ProcessBarLoadSave() {...}
  [Test]  public void HandleBatchOfFiftyLoadSave() {...}
}
Is that about it?

PARTNERS