[Tests] Add a test for multiple concatenated LZ4 frames

This commit is contained in:
Timofey Solomko
2021-10-01 14:41:16 +03:00
parent ba15f96312
commit 17bd85ba5d
3 changed files with 18 additions and 1 deletions
+13
View File
@@ -156,4 +156,17 @@ class LZ4Tests: XCTestCase {
XCTAssertEqual(decompressedData, answerData)
}
func testMultiFrameDecompress() throws {
// The test file contains three frames:
// - Legacy frame format, compressed test1.answer,
// - Skippable frame with 1233 bytes of random data,
// - Normal frame with compressed test4.answer.
let testData = try Constants.data(forTest: "test_multi_frame", withType: LZ4Tests.testType)
let result = try LZ4.multiDecompress(data: testData)
XCTAssertEqual(result.count, 2)
XCTAssertEqual(result[0], try Constants.data(forAnswer: "test1"))
XCTAssertEqual(result[1], try Constants.data(forAnswer: "test4"))
}
}