Nicolas Cellier uploaded a new version of MultilingualTests to project The Trunk:
http://source.squeak.org/trunk/MultilingualTests-nice.3.mcz ==================== Summary ==================== Name: MultilingualTests-nice.3 Author: nice Time: 8 December 2009, 11:29:29 am UUID: 5bf68562-3e8f-4a59-be7f-38659eb7f30a Ancestors: MultilingualTests-mha.2 Tests for ByteTextConverter and also for UTF8+UTF16 =============== Diff against MultilingualTests-mha.2 =============== Item was added: + ----- Method: MultiByteFileStreamTest>>testMultiByteTextConverter (in category 'testing') ----- + testMultiByteTextConverter + | strings converterClasses | + strings := { + String newFrom: ((0 to: 255) collect: [:e | Unicode value: e]). + String newFrom: ((0 to: 1023) collect: [:e | Unicode value: e]). + }. + + converterClasses := { + UTF8TextConverter . UTF16TextConverter . + "CompoundTextConverter ." + "EUCJPTextConverter . CNGBTextConverter . ShiftJISTextConverter . EUCKRTextConverter"}. + converterClasses do: [:converterClass | | converter stream | + strings do: [:string | + converter := converterClass new. + stream := String new writeStream. + converter nextPutAll: string toStream: stream. + stream := stream contents readStream. + string do: [:e | | decoded | + decoded := converter nextFromStream: stream. + self assert: e charCode = decoded charCode]. + self assert: stream atEnd. + + stream := String new writeStream. + string do: [:e | converter nextPut: e toStream: stream]. + stream := stream contents readStream. + string do: [:e | | decoded | + decoded := converter nextFromStream: stream. + self assert: e charCode = decoded charCode]. + self assert: stream atEnd]]! Item was added: + ----- Method: MultiByteFileStreamTest>>testByteTextConverter (in category 'testing') ----- + testByteTextConverter + | strings converterClasses | + strings := { + String newFrom: ((0 to: 255) collect: [:e | e asCharacter]). + }. + + converterClasses := ByteTextConverter allSubclasses. + converterClasses do: [:converterClass | + strings do: [:string | | converter stream encoded decoded encoded2 | + converter := converterClass new. + stream := string readStream. + encoded := string select: [:e | (converter nextFromStream: stream) notNil]. + stream := encoded readStream. + decoded := encoded collect: [:e | converter nextFromStream: stream]. + self assert: stream atEnd. + stream := String new writeStream. + converter nextPutAll: decoded toStream: stream. + encoded2 := stream contents. + self assert: (encoded2 collect: [:e | e charCode] as: Array) = (encoded collect: [:e | e charCode] as: Array). + stream := String new writeStream. + decoded do: [:e | converter nextPut: e toStream: stream]. + encoded2 := stream contents. + self assert: (encoded2 collect: [:e | e charCode] as: Array) = (encoded collect: [:e | e charCode] as: Array)]]! |
Free forum by Nabble | Edit this page |