mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Added test for BufferView custom contains function (#2227)
* Added test for BufferView custom contains function * Fixed test case * testBufferViewContains fixed
This commit is contained in:
1 parent
dd3b25449a
commit
d05d2fd125
2 files changed
+11
No files matched your search
@@ -158,6 +158,7 @@ extension ByteBufferTest {
|
||||
("testBufferViewEmpty", testBufferViewEmpty),
|
||||
("testBufferViewFirstIndex", testBufferViewFirstIndex),
|
||||
("testBufferViewLastIndex", testBufferViewLastIndex),
|
||||
("testBufferViewContains", testBufferViewContains),
|
||||
("testByteBuffersCanBeInitializedFromByteBufferViews", testByteBuffersCanBeInitializedFromByteBufferViews),
|
||||
("testReserveCapacityWhenOversize", testReserveCapacityWhenOversize),
|
||||
("testReserveCapacitySameCapacity", testReserveCapacitySameCapacity),
|
||||
|
||||
@@ -2071,6 +2071,16 @@ class ByteBufferTest: XCTestCase {
|
||||
XCTAssertNil(view?.lastIndex(of: UInt8(0x3F)))
|
||||
}
|
||||
|
||||
func testBufferViewContains() {
|
||||
self.buf.clear()
|
||||
self.buf.writeBytes(Array(repeating: UInt8(0x4E), count: 1024))
|
||||
self.buf.setBytes([UInt8(0x59)], at: 1000)
|
||||
let view: ByteBufferView? = self.buf.viewBytes(at: 5, length: 1010)
|
||||
XCTAssertTrue(view?.contains(UInt8(0x4E)) == true)
|
||||
XCTAssertTrue(view?.contains(UInt8(0x59)) == true)
|
||||
XCTAssertTrue(view?.contains(UInt8(0x3F)) == false)
|
||||
}
|
||||
|
||||
func testByteBuffersCanBeInitializedFromByteBufferViews() throws {
|
||||
self.buf.writeString("hello")
|
||||
|
||||
|
||||
Reference in new issue
Block a user