Levente Uzonyi uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-ul.176.mcz ==================== Summary ==================== Name: CollectionsTests-ul.176 Author: ul Time: 16 November 2010, 4:43:02.373 am UUID: 35c92cc7-8929-3341-b150-5f138670416b Ancestors: CollectionsTests-ul.175 - use #= for integer comparison instead of #== (http://bugs.squeak.org/view.php?id=2788 ) =============== Diff against CollectionsTests-ul.175 =============== Item was changed: ----- Method: DictionaryTest>>testAssociationsSelect (in category 'association tests') ----- testAssociationsSelect | answer d | d := Dictionary new. d at: (Array with: #hello with: #world) put: #fooBar. d at: Smalltalk put: #'Smalltalk is the key'. d at: #Smalltalk put: Smalltalk. answer := d associationsSelect: [:assoc | assoc key == #Smalltalk and: [assoc value == Smalltalk]]. self should: [answer isKindOf: Dictionary]. self + should: [answer size = 1]. - should: [answer size == 1]. self should: [(answer at: #Smalltalk) == Smalltalk]. answer := d associationsSelect: [:assoc | assoc key == #NoSuchKey and: [assoc value == #NoSuchValue]]. self should: [answer isKindOf: Dictionary]. self + should: [answer size = 0]! - should: [answer size == 0]! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy01 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy01 | tokens | string := 'this, is, "a, test"'. tokens := string findTokens: ',' escapedBy: '"'. + self assert: tokens size = 3! - self assert: tokens size == 3! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy03 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy03 | tokens | string := 'this, is, a, test'. tokens := string findTokens: ',' escapedBy: '"'. + self assert: tokens size = 4! - self assert: tokens size == 4! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy04 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy04 | tokens | string := 'this, is, a"," test'. tokens := string findTokens: ',' escapedBy: '"'. + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' a, test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy06 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy06 | tokens | string := 'this, is, "a, test'. tokens := string findTokens: ',' escapedBy: '"'. + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' a, test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy07 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy07 | tokens | string := 'a:b::c'. tokens := string findTokens: ':' escapedBy: '"'. + self assert: tokens size = 4. - self assert: tokens size == 4. self assert: tokens first = 'a'. self assert: tokens second = 'b'. self assert: tokens third = ''. self assert: tokens fourth = 'c'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy08 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy08 | tokens | string := 'this, is, ##a, test'. tokens := string findTokens: ',' escapedBy: '#'. + self assert: tokens size = 4. - self assert: tokens size == 4. self assert: tokens third = ' a'. self assert: tokens fourth = ' test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy09 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy09 | tokens | string := 'this, is, ###a, test#'. tokens := string findTokens: ',' escapedBy: '#'. + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' #a, test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy10 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy10 | tokens | string := 'this, is, ###a, test'. tokens := string findTokens: ',' escapedBy: '#'. + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' #a, test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy11 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy11 | tokens | string := 'this, is, """a, test"'. tokens := string findTokens: ',' escapedBy: '"'. + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' "a, test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy12 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy12 | tokens | string := 'one, two# three; four. five'. tokens := string findTokens: ',#;.' escapedBy: '"'. + self assert: tokens size = 5. - self assert: tokens size == 5. self assert: tokens third = ' three'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy13 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy13 | tokens | string := 'one, two# three; four. five'. tokens := string findTokens: ',#;.' escapedBy: nil. + self assert: tokens size = 5. - self assert: tokens size == 5. self assert: tokens third = ' three'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy14 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy14 | tokens | string := 'one, "two# three"; &four. five&'. tokens := string findTokens: ',#;.' escapedBy: '"&'. + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens second = ' two# three'. self assert: tokens third = ' four. five'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy21 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy21 | tokens | string := 'this, is, "a, test"'. tokens := string findTokens: $, escapedBy: $". + self assert: tokens size = 3! - self assert: tokens size == 3! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy23 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy23 | tokens | string := 'this, is, a, test'. tokens := string findTokens: $, escapedBy: $". + self assert: tokens size = 4! - self assert: tokens size == 4! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy24 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy24 | tokens | string := 'this, is, a"," test'. tokens := string findTokens: $, escapedBy: $". + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' a, test'! Item was changed: ----- Method: StringTest>>testFindTokensEscapedBy26 (in category 'testing - tokenizing') ----- testFindTokensEscapedBy26 | tokens | string := 'this, is, "a, test'. tokens := string findTokens: $, escapedBy: $". + self assert: tokens size = 3. - self assert: tokens size == 3. self assert: tokens third = ' a, test'! Item was changed: ----- Method: WeakSetTest>>testCollisions (in category 'testing') ----- testCollisions | ws o1 o2 o5 on remember forget | "create a weak set" ws := WeakSet new: 15. "select some fractions wanting same place in ws array" + o1 := (2 to: 100) select: [:i | (ws scanFor: 1 / i) = 1]. + o2 := (2 to: 100) select: [:i | (ws scanFor: 1 / i) = 2]. + o5 := (2 to: 100) select: [:i | (ws scanFor: 1 / i) = 5]. + on := (2 to: 100) select: [:i | (ws scanFor: 1 / i) = (ws array size - 1)]. - o1 := (2 to: 100) select: [:i | (ws scanFor: 1 / i) == 1]. - o2 := (2 to: 100) select: [:i | (ws scanFor: 1 / i) == 2]. - o5 := (2 to: 100) select: [:i | (ws scanFor: 1 / i) == 5]. - on := (2 to: 100) select: [:i | (ws scanFor: 1 / i) == (ws array size - 1)]. "Add some fractions to the weak set, and remember a pointer for a few of them" remember := OrderedCollection new. forget := OrderedCollection new. ws add: (remember add: 1 / o1 first). ws add: (forget add: 1 / on second). ws add: (forget add: 1 / o1 second). ws add: (forget add: 1 / o5 second). ws add: (forget add: 1 / o2 second). ws add: (forget add: 1 / o1 third). ws add: (remember add: 1 / o2 first). ws add: (forget add: 1 / o5 third). ws add: (forget add: 1 / on third). ws add: (remember add: 1 / o2 fourth). ws add: (remember add: 1 / on first). ws add: (remember add: 1 / o5 first). "forget and reclaim all entries but those in remember" forget := nil. Smalltalk garbageCollect. remember do: [:m | self assert: (ws includes: m)]. ws add: 1/on second. remember do: [:m | self assert: (ws includes: m)]. ws add: (remember add: 1 / o1 fourth). ws add: (remember add: 1 / on fourth). remember remove: (ws remove: (1 / o5 first)). remember remove: (ws remove: (1 / on first)). remember remove: (ws remove: (1 / o2 first)). remember remove: (ws remove: (1 / o1 first)). remember do: [:m | self assert: (ws includes: m)]. ws add: 1/on second. ws add: 1/o5 second. remember do: [:m | self assert: (ws includes: m)]. ! |
Free forum by Nabble | Edit this page |