public void SameCharacterTest() { MockBitWriter writer = new MockBitWriter(); LZWAS encoder = new LZWAS(writer); LZWAS decoder = new LZWAS(writer); for (int i = 0; i < 10; i++) { encoder.Encode(42); } encoder.EncoderFinalize(); for (int i = 0; i < 10; i++) { byte actual = decoder.Decode(); Assert.AreEqual(42, actual); } }
public void LZWASTest() { MockBitWriter writer = new MockBitWriter(); LZWAS encoder = new LZWAS(writer); LZWAS decoder = new LZWAS(writer); foreach (byte character in V) { encoder.Encode(character); } encoder.EncoderFinalize(); string output = ""; foreach (byte character in V) { byte actual = decoder.Decode(); output += (char)actual; Assert.AreEqual(character, actual); } }