File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class BZip2CompressionTests: XCTestCase {
2929 }
3030
3131 func testBZip2CompressStrings( ) throws {
32+ try stringTest ( " ban " )
3233 try stringTest ( " banana " )
3334 try stringTest ( " abaaba " )
3435 try stringTest ( " abracadabra " )
Original file line number Diff line number Diff line change @@ -19,6 +19,25 @@ class DeflateCompressionTests: XCTestCase {
1919 }
2020 }
2121
22+ func stringTest( _ string: String ) throws {
23+ let answerData = Data ( string. utf8)
24+ let compressedData = Deflate . compress ( data: answerData)
25+ let redecompressedData = try Deflate . decompress ( data: compressedData)
26+ XCTAssertEqual ( redecompressedData, answerData)
27+ }
28+
29+ func testDeflateCompressStrings( ) throws {
30+ try stringTest ( " ban " )
31+ try stringTest ( " banana " )
32+ try stringTest ( " abaaba " )
33+ try stringTest ( " abracadabra " )
34+ try stringTest ( " cabbage " )
35+ try stringTest ( " baabaabac " )
36+ try stringTest ( " AAAAAAABBBBCCCD " )
37+ try stringTest ( " AAAAAAA " )
38+ try stringTest ( " qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890 " )
39+ }
40+
2241 func testDeflate1( ) throws {
2342 try self . answerTest ( " test1 " )
2443 }
You can’t perform that action at this time.
0 commit comments