[Tests] Add a more comprehensive LZ4 truncation test

This commit is contained in:
Timofey Solomko
2026-02-24 00:50:23 +08:00
parent e8c8ccb3f2
commit 7b366f7df4
+11
View File
@@ -202,4 +202,15 @@ class LZ4Tests: XCTestCase {
}
}
func testLZ4Truncation() throws {
for i in 1...9 {
let testName = "test\(i)"
let testData = try Constants.data(forTest: testName, withType: LZ4Tests.testType)
for _ in 0..<100 {
let truncationIndex = Int.random(in: (testData.startIndex + 1)..<testData.endIndex)
_ = try? LZ4.decompress(data: testData[testData.startIndex..<truncationIndex])
}
}
}
}