The Trunk: Compression-fbs.34.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compression-fbs.34.mcz

commits-2
Frank Shearar uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-fbs.34.mcz

==================== Summary ====================

Name: Compression-fbs.34
Author: fbs
Time: 14 June 2013, 6:58:58.471 pm
UUID: 904fdc23-31b2-4273-940e-8c840cf1ee82
Ancestors: Compression-fbs.33

Pulling out Compression's tests into a separate package means that Compression no longer depends on SUnit.

=============== Diff against Compression-fbs.33 ===============

Item was removed:
- TestCase subclass: #ZipArchiveTests
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Compression-Archives'!

Item was removed:
- ----- Method: ZipArchiveTests>>testCreateWithRelativeNames (in category 'tests') -----
- testCreateWithRelativeNames
- "Test creating a zip with a relative tree of files, so that the tree will
- be created whereever the ."
- | subdir zip |
- subdir := FileDirectory default / '_test-zip-dir'.
- self deny: subdir exists.
- subdir assureExistence.
- [ subdir
- fileNamed: '_test-zip-file'
- do: [ : stream | stream nextPutAll: 'file contents' ].
- zip := ZipArchive new.
- zip
- addDirectory: subdir fullName
- as: subdir localName.
- zip
- addFile: (subdir fullNameFor: '_test-zip-file')
- as: '_test-zip-dir' , FileDirectory slash , '_test-zip-file'.
- zip writeToFileNamed: (FileDirectory default fullNameFor: '_test.zip') ]
- ensure:[
- zip close.
- subdir ifNotNil: [ subdir recursiveDelete ].
- FileDirectory default deleteFileNamed: '_test.zip'.
- ]!

Item was removed:
- ----- Method: ZipArchiveTests>>testDate29Feb2000 (in category 'tests') -----
- testDate29Feb2000
- "Ensure that dates with leap years don't screw up in the conversion"
-
- | archive mbr theDate |
- theDate := Date year: 2000 month: 2 day: 29.
- archive := ZipArchive new.
- mbr := archive addDeflateString:'foo' as: 'bar'.
- mbr setLastModFileDateTimeFrom: theDate asSeconds.
- self shouldnt:[mbr lastModTime] raise: Error.
- self assert: (Date fromSeconds: mbr lastModTime) = theDate.!

Item was removed:
- TestCase subclass: #ZipCrcTests
- instanceVariableNames: ''
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Compression-Streams'!

Item was removed:
- ----- Method: ZipCrcTests>>testInvalidGZipCrc (in category 'tests') -----
- testInvalidGZipCrc
- "See that a wrong CRC raises an appropriate error"
- | reader writer bytes crcByte |
- writer := GZipWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
- crcByte := bytes byteAt: bytes size-5. "before the length"
- bytes byteAt: bytes size-5 put: (crcByte + 1 bitAnd: 255).
-
- reader := GZipReadStream on: bytes.
- self should:[reader upToEnd] raise: CRCError.
-
- reader := GZipReadStream on: bytes.
- self should:[reader contents] raise: CRCError.
-
- reader := GZipReadStream on: bytes.
- self should:[reader next: 100] raise: CRCError.
- !

Item was removed:
- ----- Method: ZipCrcTests>>testInvalidZLibCrc (in category 'tests') -----
- testInvalidZLibCrc
- "See that a wrong CRC raises an appropriate error"
- | reader writer bytes crcByte |
- writer := ZLibWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
- crcByte := bytes byteAt: bytes size-2.
- bytes byteAt: bytes size-2 put: (crcByte + 1 bitAnd: 255).
-
- reader := ZLibReadStream on: bytes.
- self should:[reader upToEnd] raise: CRCError.
-
- reader := ZLibReadStream on: bytes.
- self should:[reader contents] raise: CRCError.
-
- reader := ZLibReadStream on: bytes.
- self should:[reader next: 100] raise: CRCError.
- !

Item was removed:
- ----- Method: ZipCrcTests>>testInvalidZipCrc (in category 'tests') -----
- testInvalidZipCrc
- "See that a wrong CRC raises an appropriate error"
- | reader writer bytes |
- writer := ZipWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc - 1.
- self should:[reader upToEnd] raise: CRCError.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc - 1.
- self should:[reader contents] raise: CRCError.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc - 1.
- self should:[reader next: 100] raise: CRCError.
- !

Item was removed:
- ----- Method: ZipCrcTests>>testMissingGZipCrc (in category 'tests') -----
- testMissingGZipCrc
- "See that the lack of a CRC raises an appropriate error"
- | reader writer bytes |
- writer := GZipWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
- bytes := bytes copyFrom: 1 to: bytes size-6.
-
- reader := GZipReadStream on: bytes.
- self should:[reader upToEnd] raise: CRCError.
-
- reader := GZipReadStream on: bytes.
- self should:[reader contents] raise: CRCError.
-
- reader := GZipReadStream on: bytes.
- self should:[reader next: 100] raise: CRCError.
- !

Item was removed:
- ----- Method: ZipCrcTests>>testMissingZLibCrc (in category 'tests') -----
- testMissingZLibCrc
- "See that the lack of a CRC raises an appropriate error"
- | reader writer bytes |
- writer := ZLibWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
- bytes := bytes copyFrom: 1 to: bytes size-2.
-
- reader := ZLibReadStream on: bytes.
- self should:[reader upToEnd] raise: CRCError.
-
- reader := ZLibReadStream on: bytes.
- self should:[reader contents] raise: CRCError.
-
- reader := ZLibReadStream on: bytes.
- self should:[reader next: 100] raise: CRCError.
- !

Item was removed:
- ----- Method: ZipCrcTests>>testMissingZipCrc (in category 'tests') -----
- testMissingZipCrc
- "See that the lack of a CRC does not raise an error"
- | reader writer bytes readBytes |
- writer := ZipWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
-
- reader := ZipReadStream on: bytes.
- self shouldnt:[readBytes := reader upToEnd] raise: CRCError.
- self assert: readBytes = 'Hello World'.
-
- reader := ZipReadStream on: bytes.
- self shouldnt:[reader contents] raise: CRCError.
-
- reader := ZipReadStream on: bytes.
- self shouldnt:[reader next: 100] raise: CRCError.
- !

Item was removed:
- ----- Method: ZipCrcTests>>testValidGZipCrc (in category 'tests') -----
- testValidGZipCrc
- | reader writer bytes |
- writer := GZipWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
- reader := GZipReadStream on: bytes.
- self assert: reader upToEnd = 'Hello World'.!

Item was removed:
- ----- Method: ZipCrcTests>>testValidZLibCrc (in category 'tests') -----
- testValidZLibCrc
- | reader writer bytes |
- writer := ZLibWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
- reader := ZLibReadStream on: bytes.
- self assert: reader upToEnd = 'Hello World'.
-
- bytes := writer encodedStream contents.
- reader := ZLibReadStream on: bytes.
- self assert: (reader next: 100) = 'Hello World'.!

Item was removed:
- ----- Method: ZipCrcTests>>testValidZipCrc (in category 'tests') -----
- testValidZipCrc
- "See that a correct CRC does not raise an error and that we can read what we wrote."
- | reader writer bytes readBytes |
- writer := ZipWriteStream on: String new.
- writer nextPutAll: 'Hello World'.
- writer close.
-
- bytes := writer encodedStream contents.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc.
- self shouldnt:[ readBytes := reader upToEnd] raise: CRCError.
- self assert: readBytes = 'Hello World'.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc.
- self shouldnt:[ readBytes := reader contents] raise: CRCError.
- self assert: readBytes = 'Hello World'.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc.
- self shouldnt:[ readBytes := reader next: 11 ] raise: CRCError.
- self assert: readBytes = 'Hello World'.
-
- reader := ZipReadStream on: bytes.
- reader expectedCrc: writer crc.
- self shouldnt:[ readBytes := reader next: 100 ] raise: CRCError.
- self assert: readBytes = 'Hello World'.!