Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.99.mcz ==================== Summary ==================== Name: CollectionsTests-nice.99 Author: nice Time: 3 October 2009, 9:23:06 am UUID: 00ad849b-6bea-4da5-a941-b7109e4d3d37 Ancestors: CollectionsTests-ul.98 Lots of tests for WideString most from http://bugs.squeak.org/view.php?id=5331 All failing tests have a solution in mantis =============== Diff against CollectionsTests-ul.98 =============== Item was added: + ----- Method: WideStringTest>>testMatch (in category 'tests - match') ----- + testMatch + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: ('*baz' match: 'mobaz' ). + self assert: ('*foo#zort' match: 'afoo3zortthenfoo3zort' ). + self assert: ('*baz' match: 'mobaz' ). + self assert: ('*foo#zort' match: 'afoo3zortthenfoo3zort' ). + + self assert: ('*baz' match: 'mobaz' asWideString). + self assert: ('*foo#zort' match: 'afoo3zortthenfoo3zort' asWideString). + self assert: ('*baz' match: 'mobaz' asWideString). + self assert: ('*foo#zort' match: 'afoo3zortthenfoo3zort' asWideString). + + self assert: ('*baz' asWideString match: 'mobaz' ). + self assert: ('*foo#zort' asWideString match: 'afoo3zortthenfoo3zort' ). + self assert: ('*baz' asWideString match: 'mobaz' ). + self assert: ('*foo#zort' asWideString match: 'afoo3zortthenfoo3zort' ). + + self assert: ('*baz' asWideString match: 'mobaz' asWideString). + self assert: ('*foo#zort' asWideString match: 'afoo3zortthenfoo3zort' asWideString). + self assert: ('*baz' asWideString match: 'mobaz' asWideString). + self assert: ('*foo#zort' asWideString match: 'afoo3zortthenfoo3zort' asWideString).! Item was added: + ----- Method: WideStringTest>>testSameAs (in category 'tests - compare') ----- + testSameAs + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: ('abc' sameAs: 'aBc' asWideString). + self assert: ('aBc' asWideString sameAs: 'abc'). + self assert: ((ByteArray with: 97 with: 0 with: 0 with: 0) asString sameAs: 'Abcd' asWideString) not. + self assert: ('a000' asWideString sameAs: (ByteArray with: 97 with: 0 with: 0 with: 0) asString) not. + ! Item was added: + ----- Method: WideStringTest>>testCharactersExactlyMatching (in category 'tests - match') ----- + testCharactersExactlyMatching + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: ('abc' charactersExactlyMatching: 'abc') = 3. + self assert: ('abd' charactersExactlyMatching: 'abc') = 2. + self assert: ('abc' charactersExactlyMatching: 'abc' asWideString) = 3. + self assert: ('abd' charactersExactlyMatching: 'abc' asWideString) = 2. + self assert: ('abc' asWideString charactersExactlyMatching: 'abc') = 3. + self assert: ('abd' asWideString charactersExactlyMatching: 'abc') = 2. + self assert: ('abc' asWideString charactersExactlyMatching: 'abc' asWideString) = 3. + self assert: ('abd' asWideString charactersExactlyMatching: 'abc' asWideString)= 2. + self assert: ('abc' charactersExactlyMatching: 'ABC') = 0. + + ! Item was added: + ----- Method: WideStringTest>>testEndsWith (in category 'tests - endsWith') ----- + testEndsWith + "Mix of tests from http://bugs.squeak.org/view.php?id=6366 + #endsWith: was broken because using broken findSubstring + and tests from johnmci at http://bugs.squeak.org/view.php?id=5331" + + | ws | + + self assert: ('abc' endsWith: 'bc'). + self assert: ('abc' endsWith: 'bc' asWideString). + self assert: ('abc' asWideString endsWith: 'bc'). + self assert: ('abc' endsWith: 'bX') not. + self assert: ('abc' endsWith: 'BC') not. + self assert: ('abc' endsWith: 'BC' asWideString) not. + self assert: ('ABC' asWideString endsWith: 'bc') not. + + self assert: ('Elvis' endsWith: 'vis'). + self assert: ('Elvis' asWideString endsWith: 'vis'). + self assert: ((WideString with: (Unicode value: 530)) , 'Elvis' endsWith: 'vis'). + + self deny: ('Elvis' endsWith: 'Vis'). + self deny: ('Elvis' asWideString endsWith: 'vIs'). + self deny: ((WideString with: (Unicode value: 530)) , 'Elvis' endsWith: 'viS'). + + ws := 'vis' , (WideString with: (Unicode value: 530)). + self deny: ('Elvis' endsWith: ws). + self assert: ('Elvis' , ws endsWith: ws). + self deny: ((WideString with: (Unicode value: 530)) , 'Elvis' endsWith: ws). + + ! Item was added: + ----- Method: WideStringTest>>testCompare (in category 'tests - compare') ----- + testCompare + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: ('abc' compare: 'abc') = 2. + self assert: ('abc' compare: 'abd') = 1. + self assert: ('abd' compare: 'abc') = 3. + self assert: ('abc' compare: 'abC') = 2. + self assert: ('abc' compare: 'abD') = 1. + self assert: ('abd' compare: 'abC') = 3. + self assert: ('aBc' compare: 'abC') = 2. + self assert: ('aBc' compare: 'abD') = 1. + self assert: ('aDd' compare: 'abC') = 3. + + + self assert: ('abc' compare: 'abc' asWideString) = 2. + self assert: ('abc' compare: 'abd' asWideString) = 1. + self assert: ('abd' compare: 'abc' asWideString) = 3. + self assert: ('abc' compare: 'abC' asWideString) = 2. + self assert: ('abc' compare: 'abD' asWideString) = 1. + self assert: ('abd' compare: 'abC' asWideString) = 3. + self assert: ('aBc' compare: 'abC' asWideString) = 2. + self assert: ('aBc' compare: 'abD' asWideString) = 1. + self assert: ('aDd' compare: 'abC' asWideString) = 3. + + self assert: ('abc' asWideString compare: 'abc') = 2. + self assert: ('abc' asWideString compare: 'abd') = 1. + self assert: ('abd' asWideString compare: 'abc') = 3. + self assert: ('abc' asWideString compare: 'abC') = 2. + self assert: ('abc' asWideString compare: 'abD') = 1. + self assert: ('abd' asWideString compare: 'abC') = 3. + self assert: ('aBc' asWideString compare: 'abC') = 2. + self assert: ('aBc' asWideString compare: 'abD') = 1. + self assert: ('aDd' asWideString compare: 'abC') = 3. + + self assert: ('abc' asWideString compare: 'abc' asWideString) = 2. + self assert: ('abc' asWideString compare: 'abd' asWideString) = 1. + self assert: ('abd' asWideString compare: 'abc' asWideString) = 3. + self assert: ('abc' asWideString compare: 'abC' asWideString) = 2. + self assert: ('abc' asWideString compare: 'abD' asWideString) = 1. + self assert: ('abd' asWideString compare: 'abC' asWideString) = 3. + self assert: ('aBc' asWideString compare: 'abC' asWideString) = 2. + self assert: ('aBc' asWideString compare: 'abD' asWideString) = 1. + self assert: ('aDd' asWideString compare: 'abC' asWideString) = 3. + + self assert: ('abc' compare: 'abc' caseSensitive: true) = 2. + self assert: ('abc' compare: 'abC' caseSensitive: false) = 2. + self assert: ('abc' compare: 'abc' asWideString caseSensitive: true) = 2. + self assert: ('abc' compare: 'abC' asWideString caseSensitive: false) = 2. + self assert: ('abc' asWideString compare: 'abc' caseSensitive: true) = 2. + self assert: ('abc' asWideString compare: 'abC' caseSensitive: false) = 2. + self assert: ('abc' asWideString compare: 'abc' asWideString caseSensitive: true) = 2. + self assert: ('abc' asWideString compare: 'abC' asWideString caseSensitive: false) = 2.! Item was added: + ----- Method: WideStringTest>>testBeginsWith (in category 'tests - beginsWith') ----- + testBeginsWith + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + | w1 w2 | + self assert: ('abc' beginsWith: 'ab'). + self assert: ('abc' beginsWith: 'ab' asWideString). + self assert: ('abc' asWideString beginsWith: 'ab'). + self assert: ('abc' beginsWith: 'aX') not . + self assert: ('abc' beginsWith: 'AB') not. + self assert: ('abc' beginsWith: 'AB' asWideString) not . + self assert: ('ABC' asWideString beginsWith: 'ab') not. + + w1 := WideString with: (Unicode value: 402) with: $a with: (Unicode value: 400) with: $b. + w2 := WideString with: (Unicode value: 402). + w1 beginsWith: w2. + ! Item was added: + ----- Method: WideStringTest>>testFindSubstring (in category 'tests - substrings') ----- + testFindSubstring + "This is related to http://bugs.squeak.org/view.php?id=6366 + finding substring in a WideString was broken because matchTable are byte-wise" + + | ws1 ws2 | + + self assert: ('abcd' findString: 'bc' startingAt: 1) = 2. + self assert: ('abcd' asWideString findString: 'bc' startingAt: 1) = 2. + self assert: ('abcd' findString: 'bc' asWideString startingAt: 1) = 2. + self assert: ('abcd' asWideString findString: 'bc' asWideString startingAt: 1) = 2. + + ws1 := 'A' , (WideString with: (Unicode value: 530)) , 'BCD'. + self assert: (ws1 findString: 'bc' startingAt: 1 caseSensitive: true) = 0. + self assert: (ws1 findString: 'bc' startingAt: 1 caseSensitive: false) = 3. + + ws2 := (WideString with: (Unicode value: 530)) , 'b'. + self assert: (ws1 findString: ws2 startingAt: 1 caseSensitive: true) = 0. + self assert: (ws1 findString: ws2 startingAt: 1 caseSensitive: false) = 2. + + self assert: ('abc' findString: ws2 startingAt: 1 caseSensitive: true) = 0. + self assert: ('abc' findString: ws2 startingAt: 1 caseSensitive: false) = 0.! Item was added: + ----- Method: WideStringTest>>testEqual (in category 'tests - compare') ----- + testEqual + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: 'abc' = 'abc'. + self assert: 'abc' = 'abc' asWideString. + self assert: 'abc' asWideString = 'abc'. + self assert: 'abc' asWideString = 'abc' asWideString. + self assert: ('abc' = 'ABC') not. + self assert: ('abc' = 'ABC' asWideString) not. + self assert: ('abc' asWideString = 'ABC') not. + self assert: ('abc' asWideString = 'abc' asWideString). + self assert: ((ByteArray with: 97 with: 0 with: 0 with: 0) asString ~= 'a000' asWideString). + self assert: ('a000' asWideString ~= (ByteArray with: 97 with: 0 with: 0 with: 0) asString).! Item was added: + ----- Method: WideStringTest>>testRelationOrder (in category 'tests - relation order') ----- + testRelationOrder + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: ('aa' < 'ab'). + self assert: ('aa' <= 'ab'). + self assert: ('aa' <= 'aa'). + self assert: ('ab' > 'aa'). + self assert: ('ab' >= 'aa'). + self assert: ('aa' >= 'aa'). + + self assert: ('aa' < 'ab' asWideString). + self assert: ('aa' <= 'ab' asWideString). + self assert: ('aa' <= 'aa' asWideString). + self assert: ('ab' > 'aa' asWideString). + self assert: ('ab' >= 'aa' asWideString). + self assert: ('aa' >= 'aa' asWideString). + + self assert: ('aa' asWideString < 'ab'). + self assert: ('aa' asWideString <= 'ab'). + self assert: ('aa' asWideString <= 'aa'). + self assert: ('ab' asWideString > 'aa'). + self assert: ('ab' asWideString >= 'aa'). + self assert: ('aa' asWideString >= 'aa'). + + self assert: ('aa' asWideString< 'ab' asWideString). + self assert: ('aa' asWideString<= 'ab' asWideString). + self assert: ('aa' asWideString<= 'aa' asWideString). + self assert: ('ab' asWideString> 'aa' asWideString). + self assert: ('ab' asWideString >= 'aa' asWideString). + self assert: ('aa' asWideString>= 'aa' asWideString).! Item was added: + ----- Method: WideStringTest>>testRelationOrderWithCase (in category 'tests - relation order') ----- + testRelationOrderWithCase + "from johnmci at http://bugs.squeak.org/view.php?id=5331" + + self assert: ('ABC' caseInsensitiveLessOrEqual: 'abc'). + self assert: ('ABC' caseInsensitiveLessOrEqual: 'abd'). + self assert: ('ABD' caseInsensitiveLessOrEqual: 'abc') not. + self assert: ('ABC' caseInsensitiveLessOrEqual: 'abc' asWideString). + self assert: ('ABC' caseInsensitiveLessOrEqual: 'abd' asWideString). + self assert: ('ABD' caseInsensitiveLessOrEqual: 'abc' asWideString) not. + self assert: ('ABC' asWideString caseInsensitiveLessOrEqual: 'abc'). + self assert: ('ABC' asWideString caseInsensitiveLessOrEqual: 'abd'). + self assert: ('ABD' asWideString caseInsensitiveLessOrEqual: 'abc') not. + self assert: ('ABC' asWideString caseInsensitiveLessOrEqual: 'abc' asWideString). + self assert: ('ABC' asWideString caseInsensitiveLessOrEqual: 'abd' asWideString). + self assert: ('ABD' asWideString caseInsensitiveLessOrEqual: 'abc' asWideString) not. + + + self assert: ('abc' caseSensitiveLessOrEqual: 'abc'). + self assert: ('abc' caseSensitiveLessOrEqual: 'abd'). + self assert: ('abd' caseSensitiveLessOrEqual: 'abc') not. + self assert: ('abc' caseSensitiveLessOrEqual: 'abc' asWideString). + self assert: ('abc' caseSensitiveLessOrEqual: 'abd' asWideString). + self assert: ('abd' caseSensitiveLessOrEqual: 'abc' asWideString) not. + self assert: ('abc' asWideString caseSensitiveLessOrEqual: 'abc'). + self assert: ('abc' asWideString caseSensitiveLessOrEqual: 'abd'). + self assert: ('abd' asWideString caseSensitiveLessOrEqual: 'abc') not. + self assert: ('abc' caseSensitiveLessOrEqual: 'ABC') not. + ! |
Free forum by Nabble | Edit this page |