mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Add support for more methods in TruncatingInputStream.
This commit is contained in:
committed by
Cody Henthorne
parent
929942de9d
commit
b00855b097
@@ -19,4 +19,20 @@ class InputStreamExtensionTests {
|
||||
assertEquals(bytes.size.toLong(), length)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when I call readAtMostNBytes, I only read that many bytes`() {
|
||||
val bytes = ByteArray(100)
|
||||
val inputStream = bytes.inputStream()
|
||||
val readBytes = inputStream.readAtMostNBytes(50)
|
||||
assertEquals(50, readBytes.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `when I call readAtMostNBytes, it will return at most the length of the stream`() {
|
||||
val bytes = ByteArray(100)
|
||||
val inputStream = bytes.inputStream()
|
||||
val readBytes = inputStream.readAtMostNBytes(200)
|
||||
assertEquals(100, readBytes.size)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user