Imported Upstream version 4.0.4.1

Former-commit-id: d8eb832a9a4b58a238f2e069a0b68c70082f8790
This commit is contained in:
Xamarin Public Jenkins
2015-08-25 18:44:33 -04:00
parent c7df8a8f93
commit 363056e66e
34 changed files with 115 additions and 39 deletions

View File

@ -362,6 +362,41 @@ namespace MonoTests.System.IO.Compression
backing.Close();
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
public void CheckBufferOverrun ()
{
byte[] data = new byte [20];
MemoryStream backing = new MemoryStream ();
DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
compressing.Write (data, 0, data.Length + 1);
compressing.Close ();
backing.Close ();
}
[Test]
public void Bug28777_EmptyFlush ()
{
MemoryStream backing = new MemoryStream ();
DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
compressing.Flush ();
compressing.Close ();
backing.Close ();
}
[Test]
public void Bug28777_DoubleFlush ()
{
byte[] buffer = new byte [4096];
MemoryStream backing = new MemoryStream ();
DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
compressing.Write (buffer, 0, buffer.Length);
compressing.Flush ();
compressing.Flush ();
compressing.Close ();
backing.Close ();
}
}
}