mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
[Tests] Add a test for 7-zip container with large LZMA dictionary size
This commit is contained in:
@@ -221,6 +221,7 @@
|
||||
E609D7B6271AFAA400068E79 /* test_small_dict_B5_BD.lz4 in Resources */ = {isa = PBXBuildFile; fileRef = E609D7B3271AFAA400068E79 /* test_small_dict_B5_BD.lz4 */; };
|
||||
E609D7B7271AFAA400068E79 /* test_small_dict_B5.lz4 in Resources */ = {isa = PBXBuildFile; fileRef = E609D7B4271AFAA400068E79 /* test_small_dict_B5.lz4 */; };
|
||||
E60CBA8A26AF379200A20130 /* test_only_dir_header.tar in Resources */ = {isa = PBXBuildFile; fileRef = E60CBA8926AF379200A20130 /* test_only_dir_header.tar */; };
|
||||
E61055CF2FB3546600A684F6 /* test_lzma_big_dict.7z in Resources */ = {isa = PBXBuildFile; fileRef = E61055CE2FB3546600A684F6 /* test_lzma_big_dict.7z */; };
|
||||
E631055927084D5D006EACC3 /* LZ4+Compress.swift in Sources */ = {isa = PBXBuildFile; fileRef = E631055827084D5D006EACC3 /* LZ4+Compress.swift */; };
|
||||
E6421E8F271B54C6000359B6 /* test_7z_lz4.7z in Resources */ = {isa = PBXBuildFile; fileRef = E6421E8E271B54C6000359B6 /* test_7z_lz4.7z */; };
|
||||
E644E11E2833AB2400EEFBAD /* minimal.gz in Resources */ = {isa = PBXBuildFile; fileRef = E644E11D2833AB2400EEFBAD /* minimal.gz */; };
|
||||
@@ -525,6 +526,7 @@
|
||||
E609D7B3271AFAA400068E79 /* test_small_dict_B5_BD.lz4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_small_dict_B5_BD.lz4; sourceTree = "<group>"; };
|
||||
E609D7B4271AFAA400068E79 /* test_small_dict_B5.lz4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_small_dict_B5.lz4; sourceTree = "<group>"; };
|
||||
E60CBA8926AF379200A20130 /* test_only_dir_header.tar */ = {isa = PBXFileReference; lastKnownFileType = archive.tar; path = test_only_dir_header.tar; sourceTree = "<group>"; };
|
||||
E61055CE2FB3546600A684F6 /* test_lzma_big_dict.7z */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_lzma_big_dict.7z; sourceTree = "<group>"; };
|
||||
E631055827084D5D006EACC3 /* LZ4+Compress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LZ4+Compress.swift"; sourceTree = "<group>"; };
|
||||
E631055A27086132006EACC3 /* SWCompression.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = SWCompression.xctestplan; path = SWCompression.xcodeproj/SWCompression.xctestplan; sourceTree = SOURCE_ROOT; };
|
||||
E6421E8E271B54C6000359B6 /* test_7z_lz4.7z */ = {isa = PBXFileReference; lastKnownFileType = file; path = test_7z_lz4.7z; sourceTree = "<group>"; };
|
||||
@@ -1046,6 +1048,7 @@
|
||||
06F066011FFB763300312A82 /* test_7z_bzip2.7z */,
|
||||
06F066021FFB763300312A82 /* test_7z_deflate.7z */,
|
||||
E6421E8E271B54C6000359B6 /* test_7z_lz4.7z */,
|
||||
E61055CE2FB3546600A684F6 /* test_lzma_big_dict.7z */,
|
||||
06F066041FFB763300312A82 /* test_empty_file.7z */,
|
||||
06F066051FFB763300312A82 /* test_empty_dir.7z */,
|
||||
06F066061FFB763300312A82 /* test_win.7z */,
|
||||
@@ -1285,6 +1288,7 @@
|
||||
06F066671FFB763400312A82 /* test2.7z in Resources */,
|
||||
062D591421248758003543BD /* test_delta_filter.xz in Resources */,
|
||||
0698B10B2104E11200A7C551 /* test_gnu_inc_format.tar in Resources */,
|
||||
E61055CF2FB3546600A684F6 /* test_lzma_big_dict.7z in Resources */,
|
||||
06F0661F1FFB763300312A82 /* test3.answer in Resources */,
|
||||
06F066281FFB763400312A82 /* test5.gz in Resources */,
|
||||
064D01AC20FD077D00CAE058 /* test_unicode_ustar.tar in Resources */,
|
||||
|
||||
@@ -18,7 +18,7 @@ public struct LZMAProperties {
|
||||
public var pb: Int = 2
|
||||
|
||||
/**
|
||||
Size of the dictionary. Default value is 1 << 24.
|
||||
Size of the dictionary. Default value is `1 << 24`.
|
||||
|
||||
- Note: Dictionary size cannot be less than 4096. In case of attempt to set it to the value less than 4096 it will
|
||||
be automatically set to 4096 instead.
|
||||
|
||||
@@ -343,6 +343,17 @@ class SevenZipTests: XCTestCase {
|
||||
XCTAssertEqual(entries[1].data, "Hello, Windows!".data(using: .utf8))
|
||||
}
|
||||
|
||||
func test7z_LzmaBigDict() throws {
|
||||
// Verifying the issue fixed by PR #61.
|
||||
// Previously, there was a crash, if LZMA dictionary size was encoded using all 4 bytes.
|
||||
let testData = try Constants.data(forTest: "test_lzma_big_dict", withType: SevenZipTests.testType)
|
||||
let entries = try SevenZipContainer.open(container: testData)
|
||||
XCTAssertEqual(entries.count, 1)
|
||||
XCTAssertEqual(entries[0].info.name, "data")
|
||||
XCTAssertEqual(entries[0].info.type, .regular)
|
||||
XCTAssertEqual(entries[0].info.size, 16 * 1024 * 1024)
|
||||
}
|
||||
|
||||
func testEmptyFile() throws {
|
||||
let testData = try Constants.data(forTest: "test_empty_file", withType: SevenZipTests.testType)
|
||||
let entries = try SevenZipContainer.open(container: testData)
|
||||
|
||||
+1
-1
Submodule Tests/Test Files updated: ceb9715d24...fae11e64d1
Reference in New Issue
Block a user