David T. Lewis uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-dtl.291.mcz ==================== Summary ==================== Name: CollectionsTests-dtl.291 Author: dtl Time: 8 July 2018, 2:00:27.93338 pm UUID: 95a16aef-4140-4539-8314-6a86a5bf8fef Ancestors: CollectionsTests-cmm.290 Add tests to cover some basic string and character operations =============== Diff against CollectionsTests-cmm.290 =============== Item was added: + ----- Method: CharacterTest>>testDigitValue (in category 'tests - creation') ----- + testDigitValue + "Answer the Character whose digit value is x. For example, + answer $9 for x=9, $0 for x=0, $A for x=10, $Z for x=35. + Results outside this range are undefined." + + self assert: $0 = (Character digitValue: 0). + self assert: $1 = (Character digitValue: 1). + self assert: $9 = (Character digitValue: 9). + self assert: $A = (Character digitValue: 10). + self assert: $B = (Character digitValue: 11). + self assert: $F = (Character digitValue: 15). + self assert: $G = (Character digitValue: 16). + self assert: $P = (Character digitValue: 25). + self assert: $Z = (Character digitValue: 35). + + ! Item was added: + ----- Method: StringTest>>testIsAllDigits (in category 'tests - testing') ----- + testIsAllDigits + self assert: '0123456789' isAllDigits. + self assert: '0123456789' asWideString isAllDigits. + self assert: '1' isAllDigits. + self assert: '1' asWideString isAllDigits. + self assert: '' isAllDigits. + self assert: '' asWideString isAllDigits. + self deny: '012345 6789' isAllDigits. + self deny: '012345 6789' asWideString isAllDigits. + self deny: ('12345', String cr) isAllDigits. + self deny: ('12345', String cr) asWideString isAllDigits. + ! Item was added: + ----- Method: StringTest>>testIsAllSeparators (in category 'tests - testing') ----- + testIsAllSeparators + self assert: ('', Character cr, Character tab, Character space) isAllSeparators. + self assert: ('', Character cr, Character tab, Character space) asWideString isAllSeparators. + self assert: ' ' isAllSeparators. + self assert: ' ' asWideString isAllSeparators. + self assert: '' isAllSeparators. + self assert: '' asWideString isAllSeparators. + self deny: '1 2' isAllSeparators. + self deny: '1 2' asWideString isAllSeparators. + self deny: ' X ' isAllSeparators. + self deny: ' X ' asWideString isAllSeparators. + + ! Item was added: + ----- Method: StringTest>>testIsAsciiString (in category 'tests - testing') ----- + testIsAsciiString + self assert: 'this is a string' isAsciiString. + self assert: 'this is a string' asWideString isAsciiString. + self assert: '' isAsciiString. + self assert: '' asWideString isAsciiString. + self deny: ('this is', (Character value: 256), 'a string') isAsciiString. + self deny: ('this is', (Character value: 128), 'a string') isAsciiString. + self assert: ('this is', (Character value: 127), 'a string') isAsciiString. + ! Item was added: + ----- Method: StringTest>>testIsOctetString (in category 'tests - testing') ----- + testIsOctetString + self assert: 'this is a string' isOctetString. + self assert: 'this is a string' asWideString isOctetString. + self assert: '' isOctetString. + self assert: '' asWideString isOctetString. + self deny: ('this is', (Character value: 256), 'a string') isOctetString. + ! |
Free forum by Nabble | Edit this page |