[squeak-dev] The Trunk: CollectionsTests-nice.95.mcz

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

[squeak-dev] The Trunk: CollectionsTests-nice.95.mcz

commits-2
Nicolas Cellier uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-nice.95.mcz

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

Name: CollectionsTests-nice.95
Author: nice
Time: 15 September 2009, 1:20:33 am
UUID: 351fdb83-c41a-4ff9-bcbf-516498d3afec
Ancestors: CollectionsTests-nice.94

WideCharacterSetTest from http://bugs.squeak.org/view.php?id=3574

=============== Diff against CollectionsTests-nice.94 ===============

Item was added:
+ ----- Method: WideCharacterSetTest>>testCreation (in category 'testing') -----
+ testCreation
+ "By now, only creation method is newFrom:"
+
+ | cs1 wcs1 cs2 wcs2 byteString wideString |
+ byteString := 'aeiouy'.
+ wideString := 'aeiouy' copyWith: 340 asCharacter.
+
+ cs1 := CharacterSet newFrom: byteString.
+ wcs1 := WideCharacterSet newFrom: byteString.
+ self should: [wcs1 = cs1].
+ self should: [wcs1 size = byteString "asSet" size].
+
+ cs2 := CharacterSet newFrom: wideString.
+ wcs2 := WideCharacterSet newFrom: wideString.
+ self should: [wcs2 = cs2].
+ self should: [wcs2 size = wideString "asSet" size].
+
+ self should: [(byteString indexOfAnyOf: wcs1) = 1] description: 'This should used optimized byteArrayMap method'.
+ self should: [(byteString indexOfAnyOf: wcs2) = 1] description: 'This should used optimized byteArrayMap method'.
+
+ self should: [('bcd' indexOfAnyOf: wcs1) = 0] description: 'This should used optimized byteArrayMap method'.
+ self should: [('bcd' indexOfAnyOf: wcs2) = 0] description: 'This should used optimized byteArrayMap method'.!

Item was added:
+ ----- Method: WideCharacterSetTest>>testAddingToCharacterSet (in category 'testing') -----
+ testAddingToCharacterSet
+
+ | cs wcs wc |
+ cs := CharacterSet newFrom: 'aeiouy'.
+ wcs := cs copy.
+ wc := 4452 asCharacter.
+
+ self shouldnt: [wcs add: wc] raise: Error description: 'adding a WideCharacter to an ordinary CharacterSet should turn it into a WideCharacterSet'.
+
+ self should: [wcs size = (cs size + 1)] description: 'We just added a Character, size should be increased by one'.
+ self shouldnt: [wcs = cs] description: 'We just added a Character, sets should not be equal'.
+ self shouldnt: [cs = wcs] description: 'We just added a Character, sets should not be equal'.
+ self should: [cs allSatisfy: [:char | wcs includes: char]] description: 'Each character of the original CharacterSet should be included in the WideCharacterSet'.
+ self should: [wcs hasWideCharacters] description: 'We just added a WideCharacter, so this WideCharacterSet definitely has one'.
+ self should: [wcs includes: wc] description: 'We just added this WideCharacter, so this WideCharacterSet should include it'.
+
+ wcs add: wc.
+ self should: [wcs size = (cs size + 1)] description: 'We just added a Character already included in the set, size should be unchanged'.
+
+ wcs remove: wc.
+ self should: [wcs size = cs size] description: 'We added then removed a Character, now size should be equal to original'.
+ self shouldnt: [wcs hasWideCharacters] description: 'We just removed the only WideCharacter, so this WideCharacterSet definitely has no WideCharacter'.
+
+ self should: [wcs = cs] description: 'A WideCharacterSet can be equal to an Ordinary CharacterSet'.
+ self should: [cs = wcs] description: 'An ordinary CharacterSet can be equal to a WideCharacterSet'.
+ self should: [cs hash = wcs hash] description: 'If some objects are equal, then they should have same hash code'.
+
+ !

Item was added:
+ TestCase subclass: #WideCharacterSetTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'CollectionsTests-Support'!
+
+ !WideCharacterSetTest commentStamp: 'nice 11/19/2007 22:45' prior: 0!
+ WideCharacterSetTest holds tests for WideCharacterSet!